In a SOLR install, when I search against a field with a multi-word search term I want SOLR to return documents that have all of the terms in the search, but they do not need to be in the exact order.
For example, if I search for title of Brown Chicken Brown Cow, I want to find all documents that contain all of the terms Brown, Chicken and Cow, irrespective of order in the title field. So, for example, the title "The chicken and the cow have brown poop" should match the query. AFAIK, this is how Google executes searches as well.
I have experimented with the following query formats:
1. Title:Brown AND Title:Chicken
2. Title:Brown AND Chicken
3. Title:Brown+Chicken
I am very confused by the results. In some instances, the first two queries return the same exact set of results. In other instances, the first version will return many results and the second version will return none. The third version seems to meet my needs, but I am confused by the different meaning of the queries.
All of my tests have been run against a field of type text_en.
<field name="Title" multiValued="false" type="text_en" indexed="true" stored="true"/>
So, what's the best SOLR query/set up for this type of search? Also, is there an easy way to make Solr.NET take a user entered search term and convert it to this type of format?
Also, will SOLR by default give documents that match the order of the search phrase a higher relevancy score? If not, what's the right levers to pull to make that happen?
Edit: Some of my confusion was caused by searching against not default fields vs default fields. Knowing this, the only format that works consistently is the first format.
If I were you I would try to use:
Title:(Brown Chicken)
Brackets will make it equivalent to your query no 1. Quotation will force Solr to search for exact match, including space and order