You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by SBS <jt...@uow.edu.au> on 2011/06/24 03:08:28 UTC

Wilcard document matches all have the same score

I am new to Lucene 3.2 and have it working well in most cases.  However, when
I do wildcard searches such as abc*, all the resulting matched documents
have exactly the same score regardless of the words that matched, their
position within the document or the size of the document.  This makes
presenting them in some meaningful order on the screen very difficult.

Is this the expected behaviour or have I done something wrong with my
indexing or searching technique?  Searches not involving wildcards produce a
range of scores as expected.

Thanks,

-sbs

--
View this message in context: http://lucene.472066.n3.nabble.com/Wilcard-document-matches-all-have-the-same-score-tp3102450p3102450.html
Sent from the Lucene - General mailing list archive at Nabble.com.

Re: Wilcard document matches all have the same score

Posted by Simon Willnauer <si...@googlemail.com>.
On Fri, Jun 24, 2011 at 3:08 AM, SBS <jt...@uow.edu.au> wrote:
> I am new to Lucene 3.2 and have it working well in most cases.  However, when
> I do wildcard searches such as abc*, all the resulting matched documents
> have exactly the same score regardless of the words that matched, their
> position within the document or the size of the document.  This makes
> presenting them in some meaningful order on the screen very difficult.
>
> Is this the expected behaviour or have I done something wrong with my
> indexing or searching technique?  Searches not involving wildcards produce a
> range of scores as expected.
>
that is expected behavior. WildcardQuery is a MultiTermQuery and for
MTQ you can / have to specify a RewriteMethod that decides what kind
of primitive query is used to execute the MTQ. if you want to use
scoring you can pass MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE to
your WildcardQuery when you create it via
WildcardQuery#setRewriteMethod(...); Yet, make sure you expect a
TooManyBooleanClauses exception if your WildcardQuery expands to too
many terms. Something like a* is not a good idea :).

simon
> Thanks,
>
> -sbs
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Wilcard-document-matches-all-have-the-same-score-tp3102450p3102450.html
> Sent from the Lucene - General mailing list archive at Nabble.com.
>