Search code examples
searchsolrluceneedismax

Solr - Exact and Stem search on same text with highlights


I am trying to perform exact and stemmed searches on text and get back "compiled" results.

Currently what I have: There is text being stored in the stem field and it's copied into the quoted field. Stem queries and exact queries work on their respective fields. When I search for (problem only with and)

"word1 word2" and/or word3

which gives me the query

stemmed:word3 &/or quote:"word1 word2

What I get is results from the two fields respectively. With or, this is fine but with and, I get back two or more results back for the same text and each has different highlighting.

The question is: what's the best way to do stem/exact search on the same text (guessing multiple fields) and if I have the right approach, what's the best way to merge these and if solr can do it?

Thanks!! Edit: I checked out edismax but fail to see how to use it properly. My results are in the comments of the answer suggesting it...


Solution

  • Please check on the Edismax Query Parser which will allow you to define the fields and have the text being searched on all of them with variable boost.