lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: where to hook in to SOLR to read field-label from functionquery
Date Thu, 08 Nov 2007 19:49:36 GMT

: Say I have a custom functionquery MinFloatFunction which takes as its
: arguments an array of valuesources. 
: MinFloatFunction(ValueSource[] sources)
: In my case all these valuesources are the values of a collection of fields.

a ValueSource isn't required to be field specifc (it may already be the 
mathematical combination of other multiple fields) so there is no generic 
way to get the "field name" form a ValueSource ... but you could define 
your MinFloatFunction only accept FieldCacheSource[] as input ... hmmm, 
ecept that FieldCacheSource doesn't expose the field name.  so instead you 

  public class MyFieldCacheSource extends FieldCacheSource {
    public MyFieldCacheSource(String field) {
    public String getField() {
      return field;
  public class MinFloatFunction ... {
    public MinFloatFunction(MyFieldCacheSource[] values);

: For this I designed a schema in which each 'row' in the index represents a
: product (indepdent of variants) (which takes care of the 1 variant max) and
: every variant is represented as 2 fields in this row:
: variant_p_*                 <-- represents price (stored / indexed)
: variant_source_*          <-- represents the other fields dependent on the
: variant (stored / multivalued)

Note: if you have a lot of varients you may wind up with the same problem 
as described here...

...because of the underlying FieldCache usage in FieldCacheValueSource


View raw message