lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "david.w.smiley@gmail.com" <david.w.smi...@gmail.com>
Subject MultiValueSource, FunctionValues and multi-value support
Date Sun, 26 Aug 2012 21:04:30 GMT
The FunctionValues API is pretty straight-forward for returning a single
value given a document ID.  However, the methods that look like void
doubleVal(int doc, double[] vals) seem to me like a very ugly wart on the
API as part of a hack to support more than one value.  There is no mention
in the FunctionValues javadocs that the caller is expected to have obtained
the FunctionValues from a MultiValueSource on which it should have
retrieved int dimension() to know how long the array is for the 2nd
argument of doubleVal(), and that this is how the result is returned.  This
is at a minimum a documentation oversight, and I hope it is plain to
everyone that it's convoluted.  And it has a shortcoming too: it doesn't
permit a variable number of values per document, since dimension() is on
ValueSource not FunctionValueSource.  Moving or copying this method to
FunctionValueSource may address this concern but this aspect of the API is
still confusing.

I think I'd rather see this just plain go away.  It is only used today to
aggregate a fixed number of ValueSources in Solr for spatial function
queries.  If more than one value source needs to be combined in some
fashion, then a ValueSource can be written to encompasses multiple
ValueSources -- indeed this is the case with HaversineFunction.  For
MultiValueSource which is used for an x & y, or an array of coordinates
(used by VectorDinstanceFunction), Solr can keep this concept to itself.
 Perhaps in the process something cleaner might come about.  Maybe extend
FunctionValues with a MultiFunctionValues which has dimension() and the
various value methods that take the outgoing value array.  But this should
stay in Solr, I think.

If it is argued that this is "too late" given the Lucene 4 beta progress,
then I suggest marking these methods + MultiValueSource as
@lucene.experimental immediately.

~ David Smiley

Mime
View raw message