Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I search set of keywords from keywords field in Solr?

So I have a keyword field with this schema Indexed, Tokenized, Multivalued, TermVector Stored, Omit Norms

then I wanna search set of keywords against it like

q=keyword:keyword1, keyword2, keyword3, etc, etc

and want to return most matching keywords, even 1 match keyword is fine, but ordered by most match.

thank you

like image 314
Faisal Avatar asked Mar 01 '23 05:03

Faisal


1 Answers

q=keyword:(keyword1 OR keyword2 OR keyword3 OR...)

Solr will give a higher score to the documents that match more keywords so they will be the first results. You can see the assigned score by appending &fl=*,score to your querystring.

like image 141
Mauricio Scheffer Avatar answered Mar 05 '23 19:03

Mauricio Scheffer