Reputation: 63
I would like to find the documents which matches all the words of the given search term.
For example I search on below fields in solr.
When I search for "My First Product", I should get the document which has either complete term in any search field or if the match happened on more than one field in the document. i.e I should get first two documents in the results.
example data:
{
“ProductName”: “My”,
"ProductDescription": “My First Product“,
"ProductSummary": “Summary”
},
{
“ProductName”: “My”,
"ProductDescription": “First”,
"ProductSummary": “Product”
},
{
“ProductName”: “Product”,
"ProductDescription": “First”,
"ProductSummary": “Nothing”
}
]
How should I achieve that in solr?
Upvotes: 0
Views: 132
Reputation: 52802
Add a catch-all copy field (in the examples this might be configured under the name _text_
).
You can then use mm=100%
or q.op=AND
to make sure that every term in your query gets matched when searching. mm
requires either the dismax
or the edismax
(recommended) query parser (defType=edismax
).
Upvotes: 1