You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (Created) (JIRA)" <ji...@apache.org> on 2011/12/12 17:45:30 UTC

[jira] [Created] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
-----------------------------------------------------------------------------------------

                 Key: LUCENE-3643
                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
             Project: Lucene - Java
          Issue Type: Improvement
          Components: core/search
    Affects Versions: 4.0
            Reporter: Uwe Schindler
            Assignee: Uwe Schindler
             Fix For: 4.0


Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Resolved] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery

Posted by "Uwe Schindler (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler resolved LUCENE-3643.
-----------------------------------

    Resolution: Fixed

Committed LUCENE-3643-noNullQueryFilter.patch to trunk revision: 1213771
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery
> --------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643-allowNullQueryFilter.patch, LUCENE-3643-noNullQueryFilter.patch, LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is MatchAllDocs.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Posted by "Uwe Schindler (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167595#comment-13167595 ] 

Uwe Schindler commented on LUCENE-3643:
---------------------------------------

With this patch applied, it's now also possible to search directly on IndexSearcher with only a filter given:

{code:java}
TopDocs topDocs = searcher.search(null, filter, topN);
{code}
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Posted by "Uwe Schindler (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13168483#comment-13168483 ] 

Uwe Schindler commented on LUCENE-3643:
---------------------------------------

I will commit the noBullQuerFilter.patch soon!
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643-allowNullQueryFilter.patch, LUCENE-3643-noNullQueryFilter.patch, LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Posted by "Uwe Schindler (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-3643:
----------------------------------

    Attachment: LUCENE-3643.patch

Patch for trunk.

It also adds tests that checks for correctly rewritten queries with correct boosts (it assigns random boosts and checks the resulting query's boost).
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Posted by "Uwe Schindler (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-3643:
----------------------------------

    Attachment: LUCENE-3643-noNullQueryFilter.patch
                LUCENE-3643-allowNullQueryFilter.patch
                LUCENE-3643.patch

Here 2 patch variants:

- allowNullQueryFilter.patch is the same patch as before, with some rewrite() improvements for more clarity, but it allows null Query and null Filter and so does IndexSearcher.
- noNullQueryFilter.patch is a simplier patch, disallowing null filters and null queries, so IndexSaercher behaves as before. The only optimization is to rewrite the MatchAllDocs+Filter combination to CSQ with combined boost.

After sleeping one night about it, I think we should start with the latter patch and maybe think about allowing a null query in IndexSearcher separately in another issue. In my opinion, the null special case should maybe done inside IS.wrapFilter. Allowing null as query or filter in FilteredQuery makes no sense and adds complexity.
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643-allowNullQueryFilter.patch, LUCENE-3643-noNullQueryFilter.patch, LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Posted by "Robert Muir (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167851#comment-13167851 ] 

Robert Muir commented on LUCENE-3643:
-------------------------------------

Hi Uwe, I think the patch looks great.

I just have one question, should we really advertise that you can pass a null Query to IndexSearcher?

I'm not saying I'm against it, but maybe we should think about it... because then maybe someone
says its strange they can't have a null query and null filter with a Sort.

If FilteredQuery optimizes the MatchAllDocsCase behind the scenes anyway, what is the harm in keeping
the current semantics?
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643.patch, LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Posted by "Uwe Schindler (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-3643:
----------------------------------

    Attachment: LUCENE-3643.patch

Here a more simplified rewrite. As rewrite is  running in a loop "while (query != query.rewrite())", we don't need to do everything on first pass. The special cases are simply expanded only on the not rewritten inner query, otherwise a new FilteredQuery is created. The second pass may rewrite the inner query.
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Posted by "Uwe Schindler (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167872#comment-13167872 ] 

Uwe Schindler commented on LUCENE-3643:
---------------------------------------

bq. I just have one question, should we really advertise that you can pass a null Query to IndexSearcher?

I heard this question quite often, how to execute a solely Filter without query. As the current API allows filter==null, why not the same for the query. Passing null as filter and query of course makes no real sense, so I don't expect this question.

I think it is harder for people to explain them that they must a) either wrap the Filter with CSQ or b) must pass a MatchAllDocsQuery. If you tell them, just call IndexSearcher.search() and pass either filter, query or both, then it's much easier.
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter

Posted by "Uwe Schindler (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-3643:
----------------------------------

    Attachment: LUCENE-3643.patch

Improved patch with more documentation in FilteredQuery.rewrite() and easier if/then/else checks (+ asserts).

Also added some more javadocs.

This cannot be backported to 3.x, because:
- In 3.x Filters are not required to only contain non-deleted documents (in trunk, they must respect non-null acceptDocs). As ConstantScoreQuery does not enforce deleted documents the optimization may return wrong results (MatchAllDocs is required)
- The API of IndexSearcher cannot be modified, so wrapFilter() is not available there. IS delegates hit collection to FilteredQuery, but it does not rewrite Filter+Query to FilteredQuery.

This is ready to commit.
                
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643.patch, LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (LUCENE-3643) Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery

Posted by "Uwe Schindler (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-3643:
----------------------------------

    Description: Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is MatchAllDocs.  (was: Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is null or MatchAllDocs. The same happens for filter==null, in this case FilteredQuery rewrites itsself to the inner query with modified boost.)
        Summary: Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery  (was: Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery, null Query or null Filter)
    
> Improve FilteredQuery to shortcut on wrapped MatchAllDocsQuery
> --------------------------------------------------------------
>
>                 Key: LUCENE-3643
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3643
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3643-allowNullQueryFilter.patch, LUCENE-3643-noNullQueryFilter.patch, LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch, LUCENE-3643.patch
>
>
> Since the rewrite of Lucene trunk to delegate all Filter logic to FilteredQuery, by simply wrapping in IndexSearcher.wrapFilter(), we can do more short circuits and improve query execution. A common use case it to pass MatchAllDocsQuery as query to IndexSearcher and a filter. For the underlying hit collection this is stupid and slow, as MatchAllDocsQuery simply increments the docID and checks acceptDocs. If the filter is sparse, this is a big waste. This patch changes FilteredQuery.rewrite() to short circuit and return ConstantScoreQuery, if the query is MatchAllDocs.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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