lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <paul.elsc...@xs4all.nl>
Subject Re: OR query on multiple fields causes low coord
Date Thu, 09 Jun 2005 18:10:35 GMT
On Thursday 09 June 2005 13:14, M. Mokotov wrote:
> Hi,
>  
> I have a question with regards to an OR query on multiple fields.
>  
> It seems that the more fields I'm splitting the documents into, the lower
> the coord is getting.
> As a result when I want to query the string S on many fields (a query like
> F1:(S) F2:(S) ... Fn:(S) ) I'm getting close-to-zero coords, which causes a
> poor matching score.
> I assume (and forgive me for assuming) that the reason is when calling
> coord( overlap, maxOverlap ), maxOverlap=|S|*n (where n is the number of
> fields on the query)
>  
> Is there any way to avoid that?
> Can I have the coord computed per field? 

Yes. For the query above, use a BooleanQuery with a Similarity that
has a constant returning coord() method. This is difficult to do the
QueryParser, but it is easy to construct it in your own code.
For the subqueries on the fields you can still use the default similarity,
as you see fit.

Have a look at the MultiFieldQueryParser in the source:
http://svn.apache.org/viewcvs.cgi/lucene/java/tags/lucene_1_4_3/src/java/org/apache/lucene/queryParser/
Instead of the BooleanQuery constructed there, use a BooleanQuery
that overrides getSimilarity().

Regards,
Paul Elschot


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message