Hi,

You would need to index that as numeric docvalues. Just add another field of 
type numeric docvalues with same or different name and use the LeafReader's 
docvalues accessors to fetch values. But that's all way too hard. You can 
create function queries without hazzle using the function queries package. Or 
much better: I'd use the lucene expressions module to do this. It allows you to 
express the scoring formula as a javascript formula and use all docvalues 
fields in your document to calculate the final score.

In both cases there is no need to create a custom scorer and everything works 
efficient. Creating own scorers just for this is way to complicated and not 
recommended. This leads to usage errors like you have discovered: slow stored 
fields, misusage of docvalues APIs (those are iterators, too) or other problems.

Uwe

-----
Uwe Schindler
Achterdiek 19, D-28357 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de

> -----Original Message-----
> From: Dominik Safaric [mailto:dominiksafa...@gmail.com]
> Sent: Wednesday, October 11, 2017 11:23 AM
> To: java-user@lucene.apache.org
> Subject: Lucene 7.x custom Scorer on point values
> 
> Recently I've implemented a custom Query that in turn scores documents
> using a custom Scorer implementation using a long primitive point values.
> The associated field is multi valued and has doc values enabled. For
> retrieving these multi valued longs I've used LeafReader.document() within
> the Scorer implementation. However, the invocation requires iterating
> through the space of matching documents which may induce performance
> degradations.
> 
> Hence my question is, what would be the most efficient implementation of a
> custom Scorer that computes scores based on the value of a multi valued
> long points field?
> 
> Thanks in advance,
> Dominik


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

Reply via email to