Surendra Shukla
Surendra Shukla

Reputation: 41

How to match sub part or super part of sentence in solr

Now if I am searching with

q:"keywords:\"best web designer in New York\""

then I don't get any record because best is not present in any record.

But what I want is it should first match with exact keyword then it should provide less matched record. like if I am searching with keyword best web designer in New York then solr must also return web designer in New York, website designer in New York, designer in New York, in New York in order of relevancy.

Thanks

Upvotes: 0

Views: 80

Answers (1)

MatsLindh
MatsLindh

Reputation: 52832

As long as you've indexed your content in a field type that is properly tokenized (the text_general field type included by default and used for text fields automagically in the schemaless mode) Solr already does that for you.

You can use the mm parameter to tell Solr that at least 70% of the terms in your query must match:

Append &mm=70% to your query string (and use the dismax or edismax query parsers):

Percentage

70%

Sets the minimum number of matching clauses to this percentage of the total number of optional clauses. The number computed from the percentage is rounded down and used as the minimum.

Upvotes: 1

Related Questions