If WildcardQuery doesn't affect the scoring of documents, why does it return 0.5 constantly?

StackOverflow https://stackoverflow.com/questions/16213964

Вопрос

I am using a WildcardQuery on documents and I see that the result documents all of them have a score of 0.5. I read that queries like WildcardQuery do not affect the scoring of documents and now I am wondering what is the cause of the score to be 0.5.

I am using this simple query:

WildcardQuery wq = new WildCardQuery("filed_name", "book");
Это было полезно?

Решение

WildcardQuery certainly does affect scoring. It uses a CONSTANT_SCORE_AUTO_REWRITE, which may be what you are referring to. That means that fields that match the WildcardQuery each have a equal boost to the score added by that match. There is, however, none of the typical Similarity logic (tf-idf, for instance) applied for the WildcardQuery's matches.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top