[
https://issues.apache.org/jira/browse/LUCENE-7736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alan Woodward updated LUCENE-7736:
----------------------------------
Attachment: LUCENE-7736.patch
I tried a few different ways of making these sources immutable, including
holding a weak hashmap of reader ids on them, but in the end I think the
cleanest API is to have a rewrite(IndexReader) method on
Double/LongValuesSource. This requires a couple of changes elsewhere in the
codebase - we already have a Sort.rewrite() method, but it wasn't being called
by IndexSearcher or SortRescorer, for example - but I think ends up with things
being neater.
I removed norms() and joinDocFreq(); all int-valued IndexReader methods now
return a DoubleValuesSource, as an int can fit into a double with no loss of
precision. IndexReaderFunctions.sumTotalTermFreq() returns a LongValuesSource,
as it delegates to a long-valued function. If a user wants to use this in an
expression, or similar, then they'll need to explicitly cast using
.toDoubleValuesSource().
A nice extra feature here would be to wrap these up in a Bindings
implementation for the expressions module, which would require moving back into
core, but that's for a follow-up issue, I think.
> Expose some IndexReader stats via DoubleValuesSources
> -----------------------------------------------------
>
> Key: LUCENE-7736
> URL: https://issues.apache.org/jira/browse/LUCENE-7736
> Project: Lucene - Core
> Issue Type: New Feature
> Reporter: Alan Woodward
> Assignee: Alan Woodward
> Priority: Minor
> Attachments: LUCENE-7736.patch, LUCENE-7736.patch
>
>
> We have a number of ValueSource implementations that expose IndexReader stats
> (numDocs, termFreq, etc). We should re-implement these as
> DoubleValuesSources, allowing them to be used in FunctionScoreQuery, etc.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]