Bick
Bick

Reputation: 18521

Sending user generated string to SOLR

I am running solr 4.3.0.
I have three simple demands of my search feature

  1. each word will be searched alone, results order will be presented by their existence and proximity.
  2. "" words between quotation mark will be searched together (near)
  3. (-) words next to minus sign will not apear in result.

I believe this is a very common search definition, so my question is what is recommended way to translate user generated free text field to the solr search http request ?

Upvotes: 0

Views: 68

Answers (1)

Jayendra
Jayendra

Reputation: 52779

You need to check the edismax query parser which will handle all of the above.

  1. By setting the qf (Query Fields), qs (Query Phrase Slop), pf (Phrase Fields), ps (Phrase Slop), pf2 (Phrase bigram fields), ps2 (Phrase bigram slop), pf3 (Phrase trigram fields), ps3 (Phrase trigram slop) parameter you can control which fields would be searched upon. Usually the words are search individually on all the fields and the scored as per the proximity
  2. mm would help you set how many query terms you need to match
  3. phrase search is supported and would be searched together.
  4. - is treated a negative operator and would result into the results being returned without the term.

Upvotes: 1

Related Questions