Vuk Vasić
Vuk Vasić

Reputation: 1418

Solr search by sentence similarity

I have a text document indexed in Solr. I want Solr search to first show the text files that have a similar sentence, and then to show files that have similar words.

So far, I have used this query:

"This is a sample text" OR This is a sample text

But then, when searching "This a sample text", for example, it will search for any document that contains ("this", "a", "sample" and "text"). Is there any method in Solr for the search to first provide results with similar sentences and then words.

Upvotes: 1

Views: 680

Answers (1)

femtoRgon
femtoRgon

Reputation: 33351

A phrase query with slop (or proximity search) sounds like what you are looking for.

Such as:

"This a sample text"~3 this a sample text

Upvotes: 3

Related Questions