Use the docValues interface by calling getSortedSetDocValues on the leaf reader. That will either 1) use real docValues if you have indexed them 2) use the FieldCache to uninvert an indexed field and make it look like docValues.
-Yonik On Thu, Jul 7, 2016 at 1:33 PM, paule_lecuyer <lecu...@bertin.fr> wrote: > Hi all, > I wrote some time ago a ValueSourceParser + ValueSource to allow using > results produced by an external system as a facet query : > - in solrconfig.xml : added my parser : > <valueSourceParser name="irboost" class="myValueSourceParser /> > > - in search queries, use irboost function as a facet query : > > /solr/core/query?q=<keywords>&fq=irboost('somename')&fl=*,score,_val_:irboost('somename') > > - in ValueSourceParser, the 'somename' info allows to retrieve a map of > (docId, score) produced by the external system, which is passed in > ValueSource constructor > - in valueSource.getValues, I used the following code : > > final BinaryDocValues lookup = > FieldCache.DEFAULT.getTerms(readerContext.reader(), docIdField, false); > return new FunctionValues() { > @override > public float floatVal( int doc) { > BytesRef ref = new BytesRef(); > lookup.get(doc, ref) > return getMyScore(ref.utf8ToString()); > } > ... > > Apart from changing AtomicReaderContext to LeafReaderContext, It seems I > cannot use anymore FieldCache as I did. What can I use to retrieve the > content of the docId Field linked to the document <doc> passed to floatval > func ? > > Thanks for your help. > Paule > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Port-of-Custom-value-source-from-v4-10-3-to-v6-1-0-tp4286236.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org