lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <gsing...@apache.org>
Subject Re: Subset match query?
Date Wed, 03 Oct 2007 20:42:46 GMT
See the Similarity.coord() method.

/** Computes a score factor based on the fraction of all query terms  
that a
    * document contains.  This value is multiplied into scores.
    *
    * <p>The presence of a large portion of the query terms indicates  
a better
    * match with the query, so implementations of this method usually  
return
    * larger values when the ratio between these parameters is large  
and smaller
    * values when the ratio between them is small.
    *
    * @param overlap the number of query terms matched in the document
    * @param maxOverlap the total number of terms in the query
    * @return a score factor based on term overlap with the query
    */
   public abstract float coord(int overlap, int maxOverlap);

Cheers,
Grant

On Oct 3, 2007, at 2:20 PM, Kyle Maxwell wrote:

> I'm indexing a dataset with lots of short fields.  I have  
> determined that it
> would be useful to highly boost matches where every term in this  
> field is
> represented in the query. i.e.:
> Query: lucene field matches
> Field: lucene field
> but not
> Field: lucene has a field ...
> Field: lucene field foo...
>
> I'm finding this to be very difficult to implement.  I believe that  
> I could
> write a query to count the term matches in a field, but I'm not  
> sure how, in
> a subclass of query, it would be possible to efficiently count the  
> total
> number of terms in the field.  Any advice would be welcome!
>
> -Kyle

--------------------------
Grant Ingersoll
http://lucene.grantingersoll.com

Lucene Boot Camp Training:
ApacheCon Atlanta, Nov. 12, 2007.  Sign up now!  http:// 
www.apachecon.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ



---------------------------------------------------------------------
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