質問

I search for game "Mass Effect 2"

http://localhost:8085/solr/select/?defType=edismax&qf=title&q=Mass+Effect+2&mm=1

Besides of "Mass Effect 2" and "The Showdown Effect" it finds things like "Borderlands 2", "Prototype 2" and other games having "2" in their name. So I want to exclude documents which matched only by "2".

title field is defined as:

<field name="title" type="text" indexed="true" stored="true" multiValued="false" />
役に立ちましたか?

解決

It's not an exact answer, but an easy one that could be ok for your case. You can use the minimum should match parameter and the edismax query parser, so if there's a number in your query you can increase the number and use 2 for example.

http://wiki.apache.org/solr/DisMaxQParserPlugin#mm_.28Minimum_.27Should.27_Match.29

Taking in account that rather than excluding only-numbers, the use case can be told as "use an argument just for boosting", you can rewrite the query and use a nested one for the score. as writen in: http://searchhub.org/2009/03/31/nested-queries-in-solr your query could be writen

 text:Mass Effect OR query:"{!dismax mm=2 }Mass effect 2"

the idea it's to make the query without the number and include the number as a nested query to boost the numbers

他のヒント

Would the 'pf' phrase boost instead of quoted phrase search give you a better result? It says with all elements in proximity, not necessarily the same order.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top