CoveringQuery based on length of multivalued field

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CoveringQuery based on length of multivalued field

Tristan Stevens
Hi,
I’ve been using CoveringQuery to specify a minimum number of queries that
need to match for a document to match overall, where we use the constructor:

public CoveringQuery(Collection<Query> queries, LongValuesSource
minimumNumberMatch)

(
https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;a=blob;f=lucene/sandbox/src/java/org/apache/lucene/search/CoveringQuery.java
)

The second argument LogValuesSource is the name of a field which specifies
how many of the queries must match.

I think it would be a useful feature to have an alternative constructor
which allows you to specify a multiValued field, for which the length of
the field (i.e. the number of terms in the MV field) is used as the
minimumNumberMatch instead.

The implementation should be fairly simple, however I don’t know my way
around the Lucene APIs well enough to replace LongValuesSource with the
equivalent multi-valued length.

I’d be grateful for advice on whether this is a worthwhile feature, and
some advice on how I could write such a constructor. If people are happy
then I will submit a JIRA.

Thanks,
Tristan