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

Uwe Schindler commented on LUCENE-5970:
---------------------------------------

I agree with Yonik here. I had a talk about IndexReader context on 2 Lucene 
conferences (in Boston and Berlin) and the need for the context is quite clear 
(in non-esoteric use cases).

My problem is only that the rename of the getContext() method on reader leads 
to this confusion. reader -> contex -> reader is unfortunately not 
bidirectional (otherwise the context would not be needed). Previously the 
method was named getTopReaderContext(), but this was also not easy to 
understand.

The getContext() method returns a context with the reader the method was called 
on as "top" reader.

Hardcoding things like docBases into the Reader itsself is impossible, because 
what happens if you wrap 3 DirectoryReaders with one MultiReader? From the 
viewpoint of the multireader the 3 subreaders and its leaf readers have 
different docbases than when seen from the 3 directory readers. This was the 
main reason to add the reader context. In general, calling "getContext" on a 
reader should only be done once and not suddenly from inside a query, because 
this is a bug.

I will post a link to my explanatory talk here.

> Remove IndexReaderContext/CompositeReaderContext/AtomicReaderContext
> --------------------------------------------------------------------
>
>                 Key: LUCENE-5970
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5970
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>
> This hierarchy is mega-confusing, has a overcomplicated hierarchy, and is 
> full of bugs.
> For example, in a two-segment index with one document in each:
> {code}
> context.docbase: 1
> context.reader().getContext().docBase: 0
> {Code}
> There is just no need for all this. We can replace it all with 'docbase'. For 
> the esoteric stuff solr wants to do, like top-level crap, it can do this with 
> its own filterreader instead, rather than pushing the complexity into lucene.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to