I have indexed a file with fields -
- Content (type :text_general, uninvertible :false, indexed :true, stored :true)
- Category (type :text_general, uninvertible :false, indexed :true, stored :true)
- Title (type :text_general, uninvertible :false, indexed :true, stored :true)
with a catch-all copyfield-
source: *,
dest :_text_
Now when I search Content field, for query - Apple trade , I get 6057 docs;
But when I search - trade Apple , I get 5878 docs.
However when the same search is performed on the catch-all field , I get same result for both the queries (6057 docs).
I am not understanding the mistake here, as I would wish solr to give same result for both queries when searched on Content field.
I am using-
- LuceneQParser
- ClassicSimilarity
Two queries on 'Content' Field :
- Apple trade
http://localhost:8983/solr/core_name/select?q=Content%3A%20Apple%20trade
- trade Apple
http://localhost:8983/solr/core_name/select?q=Content%3A%20trade%20Apple
From what you just added to your question and assuming the Lucene query parser ignores the space after your
:, the query isContent:trade <default search field>:Apple- you're not searching for both the first and second term in theContentfield.When you swap their places, you're searching for
Content:Apple <default search field>:trade.The default search field is
_text_in the default configuration. Since the queries are different, you can assume that there is different content in the field (for example by not reindexing properly and cleaning out the index after adding thecopyFieldinstruction).If you want to use free text search that easily maps to user input, use the edismax query parser instead (
defType=edismax), supply the query inq=apple trade, and supply the field names inqf=Content.