Hi,

This is a known problem currently. I think there is already an issue open, so 
this was not solved for 4.0 (I don't have the issue no available at the moment).

My plan to fix this is to make Filters behave like queries (with a rewrite() 
method), so the correct context can be passed to a "rewritten" filter (when 
QueryWrapperFilter rewrites, it rewrites also the query). The current approach 
is for performance reasons, because without rewrite, you would have no 
persistent "state" information between index segments, so the Query has to be 
rewritten on the top-level index for every segment again. By the current 
approach, the query is only rewritten against the current segment with a 
private IndexSearcher. By that process the docBase gets lost. So currently this 
does not work.

I would recommend to *not* use QueryWrapperFilter and instead wrap with 
ConstantScoreQuery and add it to the query as a Boolean MUST clause. In that 
case it should work fine. There is no performance increase by using 
QueryWrapperFilter, so no reason to use it.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


> -----Original Message-----
> From: Thomas Matthijs [mailto:li...@selckin.be]
> Sent: Monday, October 08, 2012 11:13 AM
> To: java-user@lucene.apache.org
> Subject: lucene-4.0: QueryWrapperFilter & docBase
> 
> Hello,
> 
> I have some custom queries & scorer that need to able to construct the 
> "global"
> docIds (doc + docBase).
> 
> But when i use these in a QueryWrapperFilter they no longer work, because
> QueryWrapperFilter.getDocIdSet uses a "private context"
> (context.reader().getContext();) which always has a docBase of 0, and this is
> definitely called for every segment as far as i can see, so the correct 
> docBase is
> lost here, I tried to naively change it to pass the original context but that 
> blows
> up in asserts, I don't really understand how this all should work.
> 
> How do i get the correct docBase in scorers when using QueryWrappedFilter ?
> 
> Let me know if you want an example/test.
> 
> Thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org


---------------------------------------------------------------------
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