[ 
https://issues.apache.org/jira/browse/LUCENE-5327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13818394#comment-13818394
 ] 

Shai Erera commented on LUCENE-5327:
------------------------------------

I don't think the API isn't useful, just that it's wrong to have it on 
IndexSearcher where there's no matching API on IndexReader.

If you use MultiDocValues, you shouldn't write that complicated code, you could 
instead do:

{code}
NumericDocValues uid = 
MultiDocValues.getNumericDocValues(searcher.getIndexReader(), "uid");
for (ScoreDoc sd : topDocs.scoreDocs) {
  long uidValue = uid.get(sd.doc);
}
{code}

That's not so bad I think? I mean, IndexSearcher.getNumericDocValues() will 
essentially save you just the first call, so I don't see any great benefits in 
having the API there.

If you want to avoid the binary search, you should re-sort the topDocs by 
increasing doc IDs, then iterate on reader.leaves(), obtain the NDV from each 
AtomicReader and pull the right values. First, I don't think you should do 
that, unless you're asking for thousands of hits. Second, this won't be solved 
by adding IndexSearcher.getNDV().

I agree w/ Uwe, I think we should close that issue as "Won't Fix".

> Expose getNumericDocValues and getBinaryDocValues at toplevel reader and 
> searcher levels
> ----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-5327
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5327
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.5
>            Reporter: John Wang
>         Attachments: patch.diff
>
>
> Expose NumericDocValues and BinaryDocValues in both IndexReader and 
> IndexSearcher apis.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

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

Reply via email to