You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Yonik Seeley <ys...@gmail.com> on 2016/07/08 12:56:25 UTC

Re: Port of Custom value source from v4.10.3 to v6.1.0

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 <le...@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Port of Custom value source from v4.10.3 to v6.1.0

Posted by Yonik Seeley <ys...@gmail.com>.
Use getSortedDocValues for a single-valued field, or
getSortedSetDocValues for multi-valued.

-Yonik


On Fri, Jul 8, 2016 at 12:29 PM, paule_lecuyer <le...@bertin.fr> wrote:
> Many Thanks Yonik,  I will try that.
>
> For my understanding, what is the difference between SortedSetDocValues
> getSortedSetDocValues(String field) and SortedDocValues
> getSortedDocValues(String field) ?
>
> Paule.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Upgrade-of-Custom-value-source-code-from-v4-10-3-to-v6-1-0-tp4286236p4286387.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
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Port of Custom value source from v4.10.3 to v6.1.0

Posted by paule_lecuyer <le...@bertin.fr>.
Many Thanks Yonik,  I will try that.

For my understanding, what is the difference between SortedSetDocValues
getSortedSetDocValues(String field) and SortedDocValues
getSortedDocValues(String field) ?

Paule.



--
View this message in context: http://lucene.472066.n3.nabble.com/Upgrade-of-Custom-value-source-code-from-v4-10-3-to-v6-1-0-tp4286236p4286387.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