Bokambo
Bokambo

Reputation: 4480

Solr Search Query for word must occur after specific position

I want to write Solr query for something as below :

apple w/5 pear - apple must occur within 5 words of pear

How i can achieve the same ? Is their any regex for same ?

Upvotes: 0

Views: 53

Answers (1)

James Doepp - pihentagyu
James Doepp - pihentagyu

Reputation: 1308

This can be done by enclosing the terms in quotations and using a tilde to indicate proximity:

q="apple pear"~5

If just the quotations are present, that is the same as ~0, that is, they should be next to each other.

Upvotes: 1

Related Questions