Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6415

TermsQuery.extractTerms should not throw an UOE

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.1
    • Fix Version/s: 5.2, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      TermsQuery inherits the default impl of extractTerms which throws an UnsupportedOperationException.

      1. LUCENE-6415.patch
        2 kB
        Adrien Grand
      2. LUCENE-6415.patch
        1.0 kB
        Adrien Grand

        Activity

        Hide
        thetaphi Uwe Schindler added a comment - - edited

        I think it should be abstract in Query. The UOE was only added in Lucene 1.x or 2.x for backwards compatibility reasons

        Show
        thetaphi Uwe Schindler added a comment - - edited I think it should be abstract in Query. The UOE was only added in Lucene 1.x or 2.x for backwards compatibility reasons
        Hide
        rcmuir Robert Muir added a comment -

        I actually think it should. I know how people abuse this query and do not think we should implement an unbounded extractTerms. UOE is much better.

        Show
        rcmuir Robert Muir added a comment - I actually think it should. I know how people abuse this query and do not think we should implement an unbounded extractTerms. UOE is much better.
        Hide
        jpountz Adrien Grand added a comment -

        Uwe: I was also wondering that it might make sense to move this method to Weight so that we only have to implement it for core queries and not those that always rewrite to a different query? (extractTerms documentation states it only makes sense on rewritten queries)

        Robert: The issue is that it fails term extraction for the whole query even if this query is only used for filtering. Maybe we could make extractTerms a no-op on TermsQuery and then it would behave just like when this query was still only a filter?

        Show
        jpountz Adrien Grand added a comment - Uwe: I was also wondering that it might make sense to move this method to Weight so that we only have to implement it for core queries and not those that always rewrite to a different query? (extractTerms documentation states it only makes sense on rewritten queries) Robert: The issue is that it fails term extraction for the whole query even if this query is only used for filtering. Maybe we could make extractTerms a no-op on TermsQuery and then it would behave just like when this query was still only a filter?
        Hide
        jpountz Adrien Grand added a comment -

        Here is a proposal: it makes TermsQuery.extractTerms a no-op.

        Show
        jpountz Adrien Grand added a comment - Here is a proposal: it makes TermsQuery.extractTerms a no-op.
        Hide
        rcmuir Robert Muir added a comment -

        We should also fix the javadocs of this class? Now that its a query, its very confusing.

        It should mention that it does not score, maybe with an example like:

        This is equivalent to a ConstantScoreQuery(BooleanQuery(x, y, z), 1F) but potentially more efficient.

        Show
        rcmuir Robert Muir added a comment - We should also fix the javadocs of this class? Now that its a query, its very confusing. It should mention that it does not score, maybe with an example like: This is equivalent to a ConstantScoreQuery(BooleanQuery(x, y, z), 1F) but potentially more efficient.
        Hide
        jpountz Adrien Grand added a comment -

        Same patch with improved javadocs, does it look better?

        Show
        jpountz Adrien Grand added a comment - Same patch with improved javadocs, does it look better?
        Hide
        rcmuir Robert Muir added a comment -

        great, thanks!

        Show
        rcmuir Robert Muir added a comment - great, thanks!
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1673118 from Adrien Grand in branch 'dev/trunk'
        [ https://svn.apache.org/r1673118 ]

        LUCENE-6415: Make TermsQuery.extractTerms a no-op instead of throwing an UOE.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1673118 from Adrien Grand in branch 'dev/trunk' [ https://svn.apache.org/r1673118 ] LUCENE-6415 : Make TermsQuery.extractTerms a no-op instead of throwing an UOE.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1673119 from Adrien Grand in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1673119 ]

        LUCENE-6415: Make TermsQuery.extractTerms a no-op instead of throwing an UOE.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1673119 from Adrien Grand in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1673119 ] LUCENE-6415 : Make TermsQuery.extractTerms a no-op instead of throwing an UOE.
        Hide
        anshumg Anshum Gupta added a comment -

        Bulk close for 5.2.0.

        Show
        anshumg Anshum Gupta added a comment - Bulk close for 5.2.0.

          People

          • Assignee:
            jpountz Adrien Grand
            Reporter:
            jpountz Adrien Grand
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development