[ https://issues.apache.org/jira/browse/SOLR-12697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17340860#comment-17340860 ]
Tom Gilke commented on SOLR-12697: ---------------------------------- Hello, Tobi and I used the following approach to tackle the problem: {code:java} public class DocValuesFieldValueFeatureScorer extends FieldValueFeatureScorer { final LeafReaderContext context; NumericDocValues floatDocValues; public DocValuesFieldValueFeatureScorer(final FeatureWeight weight, final LeafReaderContext context, final DocIdSetIterator itr) { super(weight, context, itr); this.context = context; try { floatDocValues = DocValues.getNumeric(context.reader(), field); } catch (IOException e) { // this is fine for fields that do not have docValues, we handle that case with super.score() floatDocValues = null; } } @Override public float score() throws IOException { if (floatDocValues != null && floatDocValues.advanceExact(itr.docID())) { // convert float value that was stored as long back to float if (NumberType.FLOAT.equals(docValuesType)) { return Float.intBitsToFloat((int) floatDocValues.longValue()); // just take the long value } else if (NumberType.LONG.equals(docValuesType)) { return floatDocValues.longValue(); } else { throw new IllegalArgumentException(String.format("%s type of field %s is not supported!", docValuesType, field)); } } else { // use stored field values, fallback to default behavior in FieldValueFeature return super.score(); } } }{code} Does that help with the problem of using the docFetcher? If so, than we could improve the code and contribute it. > pure DocValues support for FieldValueFeature > -------------------------------------------- > > Key: SOLR-12697 > URL: https://issues.apache.org/jira/browse/SOLR-12697 > Project: Solr > Issue Type: Sub-task > Components: contrib - LTR > Reporter: Stanislav Livotov > Priority: Major > Attachments: SOLR-12697.patch, SOLR-12697.patch, SOLR-12697.patch, > SOLR-12697.patch, SOLR-12697.patch > > > [~slivotov] wrote in SOLR-12688: > bq. ... FieldValueFeature doesn't support pure DocValues fields (Stored > false). Please also note that for fields which are both stored and DocValues > it is working not optimal because it is extracting just one field from the > stored document. DocValues are obviously faster for such usecases. ... > (Please see SOLR-12688 description for overall context and analysis results.) -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org