lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paule_lecuyer <lecu...@bertin.fr>
Subject Port of Custom value source from v4.10.3 to v6.1.0
Date Thu, 07 Jul 2016 17:33:56 GMT
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message