Chethan Swaroop
Chethan Swaroop

Reputation: 192

Full Match on a Field in Solr Search

I'm having a field called "QUERY_TERMS" which consists of words separated by a space.

Example: "QUERY_TERMS": "chet swaroop"

This record/document should be returned as a result only when the query contains both the terms included in the list say "chet" and "swaroop"

Example: Instances when the record/document is returned in Solr, i.) "chet swaroop" ii.) "swaroop chet: iii.) "chet blah blah swaroop" iv.) "swaroop blah blah chet"

Instances when the record/document should not be returned in Solr, i.) "chet" ii.)"swaroop" iii.)" chet blah blah" iv.) "blha blah swaroop"

Could anyone suggest the query to match the above requirements.

Upvotes: 0

Views: 640

Answers (3)

Sukhdeep Kharbanda
Sukhdeep Kharbanda

Reputation: 1

(chet && swaroop) will return record/document as a result only when the query contains both the terms included in the list say "chet" and "swaroop"

Upvotes: 0

Piyush_Rana
Piyush_Rana

Reputation: 305

have a look at the below link :- http://www.solrtutorial.com/solr-query-syntax.html

If the distance between the two words are somewhat fixed and known then Proximity Mathching may help .

Upvotes: 0

Alexandre Rafalovitch
Alexandre Rafalovitch

Reputation: 9789

If by both, you mean all terms provided, then you should look into mm=100% available with disMax and eDisMax.

Upvotes: 1

Related Questions