On Mon, Oct 8, 2012 at 11:28 AM, Uwe Schindler <u...@thetaphi.de> wrote:
> 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.

It's important for me that the score does not change from what it was
before, and i'm unable to construct a booleanquery w/ CSQ that
basically ignores the filter score.

So i made a quick attempt at a basic FilteredQuery
(http://pastie.org/4932671) Just returning a ConjunctionScorer with
both the query & filter query, and overriding score() to return the
query score should do the trick i think?

This seems to work correctly in most cases but a test where i just
have a MUST_NOT clause in a (boolean)filter does not work this way,
because BooleanQuery with a single MUST_NOT clause just shortcircuits
this case and returns null from scorer(). A single MUST_NOT clause
worked correct in a BooleanFilter.

I can't wrap my head around it yet why its ok for BooleanQuery to
ignore these clauses ? Anyway i'm now attempting to make a scorer for
only prohibited clauses.

I guess my question is, is there an easier way i'm missing?


Thanks

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