Hi,

I have a custom Facet implementation that extends SimpleFacets
and overrides getTermCounts( String field ).

For the price field I calculate available ranges, for this I
have to read the values for this field. Right this looks like
this:

    public NamedList getTermCounts( final String field ) throws IOException {
        SchemaField sf = searcher.getSchema().getField( field );
        FieldType ft = sf.getType();
        final DocValues docValues = ft.getValueSource( sf ).getValues( 
searcher.getReader() );
        final DocIterator iter = docs.iterator();
        final TIntArrayList prices = new TIntArrayList( docs.size() );
        while (iter.hasNext()) {
           float value = docValues.floatVal(iter.next());
           prices.add( (int)value );
        }
        // calculate ranges and return the result
    }

This part (reading field values) takes fairly long compared
to the other fields (that use getFacetTermEnumCounts or
getFieldCacheCounts as implemented in SimpleFacets), so that
I asume that there is potential for optimization.

Fairly long: getFieldCacheCounts for the cat field takes ~70 ms
for the second request, while reading prices takes ~600 ms.

Is there a better way (in terms of performance) to determine
the values for the found docs?

Thanx in advance,
cheers,
Martin
                

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to