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

SpanPayloadCheckQuery and PayloadScoreQuery are missing rewrite methods

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.x
    • Fix Version/s: 7.0, 6.6
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      If used with a wildcard query, the result is a failure saying: "Rewrite query first"

      The SpanNearQuery has the rewrite method; however the SpanPayloadCheckQuery just returns the query itself.

      this works:

      ```
      spanNear([vectrfield:ebyuugz, SpanMultiTermQueryWrapper(vectrfield:e*), SpanMultiTermQueryWrapper(vectrfield:m*), SpanMultiTermQueryWrapper(vectrfield:f*)], 0, true)
      ```

      code to generate the query:

      ```
      private Query getSpanQuery(String[] parts, int howMany, boolean truncate) throws UnsupportedEncodingException {
      SpanQuery[] clauses = new SpanQuery[howMany+1];
      clauses[0] = new SpanTermQuery(new Term("vectrfield", parts[0])); // surname
      for (int i = 0; i < howMany; i++) {
      if (truncate)

      { SpanMultiTermQueryWrapper<WildcardQuery> q = new SpanMultiTermQueryWrapper<WildcardQuery>(new WildcardQuery(new Term("vectrfield", parts[i+1].substring(0, 1) + "*"))); clauses[i+1] = q; }

      else

      { clauses[i+1] = new SpanTermQuery(new Term("vectrfield", parts[i+1])); }

      }
      SpanNearQuery sq = new SpanNearQuery(clauses, 0, true); // match in order
      return sq;
      }
      ```

      and this fails:

      ```
      spanPayCheck(spanNear([vectrfield:ebyuugz, SpanMultiTermQueryWrapper(vectrfield:e*), SpanMultiTermQueryWrapper(vectrfield:m*), SpanMultiTermQueryWrapper(vectrfield:f*)], 1, true), payloadRef: 0;1;2;3
      ```

      each clause is made of:

      ```
      new SpanMultiTermQueryWrapper<WildcardQuery>(new WildcardQuery(new Term("vectrfield", parts[i+1].substring(0, 1) + "*")));
      ```

      It is a regression; the code was working well in SOLR4.x

        Activity

        Hide
        jpountz Adrien Grand added a comment -

        You are right, it should rewrite the inner query. Would you like to work on a patch?

        Show
        jpountz Adrien Grand added a comment - You are right, it should rewrite the inner query. Would you like to work on a patch?
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 72e616dd52b2b3979ef4e824966ac4ce0de592ba in lucene-solr's branch refs/heads/master from Erik Hatcher
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=72e616d ]

        LUCENE-7481: Fix SpanPayloadCheckQuery rewrite

        Show
        jira-bot ASF subversion and git services added a comment - Commit 72e616dd52b2b3979ef4e824966ac4ce0de592ba in lucene-solr's branch refs/heads/master from Erik Hatcher [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=72e616d ] LUCENE-7481 : Fix SpanPayloadCheckQuery rewrite
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit f4bdb44fd8c6d13845355cefffccb963941bfa8f in lucene-solr's branch refs/heads/master from Erik Hatcher
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=f4bdb44 ]

        LUCENE-7481: Fix PayloadScoreQuery rewrite

        Show
        jira-bot ASF subversion and git services added a comment - Commit f4bdb44fd8c6d13845355cefffccb963941bfa8f in lucene-solr's branch refs/heads/master from Erik Hatcher [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=f4bdb44 ] LUCENE-7481 : Fix PayloadScoreQuery rewrite
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 5fdf9129b047b823f6f8530fb3a11539ce6dcb8a in lucene-solr's branch refs/heads/master from Erik Hatcher
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=5fdf912 ]

        Add CHANGES entry for LUCENE-7481

        Show
        jira-bot ASF subversion and git services added a comment - Commit 5fdf9129b047b823f6f8530fb3a11539ce6dcb8a in lucene-solr's branch refs/heads/master from Erik Hatcher [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=5fdf912 ] Add CHANGES entry for LUCENE-7481
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 64caf176ba92beeadf6856bfeac5cf8043d8251b in lucene-solr's branch refs/heads/master from Erik Hatcher
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=64caf17 ]

        LUCENE-7481: fix rewrite methods
        LUCENE-7808: fix .equals/.hashCode methods

        Show
        jira-bot ASF subversion and git services added a comment - Commit 64caf176ba92beeadf6856bfeac5cf8043d8251b in lucene-solr's branch refs/heads/master from Erik Hatcher [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=64caf17 ] LUCENE-7481 : fix rewrite methods LUCENE-7808 : fix .equals/.hashCode methods
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit d38fe75c65a38924072aa0876e7668bd31151c52 in lucene-solr's branch refs/heads/branch_6x from Erik Hatcher
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=d38fe75 ]

        LUCENE-7481: Fix SpanPayloadCheckQuery rewrite

        Show
        jira-bot ASF subversion and git services added a comment - Commit d38fe75c65a38924072aa0876e7668bd31151c52 in lucene-solr's branch refs/heads/branch_6x from Erik Hatcher [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=d38fe75 ] LUCENE-7481 : Fix SpanPayloadCheckQuery rewrite
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 85f97bd8ce6a8e110f745715f6b0ede049f04832 in lucene-solr's branch refs/heads/branch_6x from Erik Hatcher
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=85f97bd ]

        LUCENE-7481: Fix PayloadScoreQuery rewrite

        Show
        jira-bot ASF subversion and git services added a comment - Commit 85f97bd8ce6a8e110f745715f6b0ede049f04832 in lucene-solr's branch refs/heads/branch_6x from Erik Hatcher [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=85f97bd ] LUCENE-7481 : Fix PayloadScoreQuery rewrite
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 65b86842d2582b63b9f1d8d88dd69fd892f51e82 in lucene-solr's branch refs/heads/branch_6x from Erik Hatcher
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=65b8684 ]

        Add CHANGES entry for LUCENE-7481

        Show
        jira-bot ASF subversion and git services added a comment - Commit 65b86842d2582b63b9f1d8d88dd69fd892f51e82 in lucene-solr's branch refs/heads/branch_6x from Erik Hatcher [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=65b8684 ] Add CHANGES entry for LUCENE-7481
        Hide
        ehatcher Erik Hatcher added a comment -

        whew! (apologies for the multiple commits, just getting familiar with how to local branch and not squash merge - lesson learned)

        Show
        ehatcher Erik Hatcher added a comment - whew! (apologies for the multiple commits, just getting familiar with how to local branch and not squash merge - lesson learned)

          People

          • Assignee:
            ehatcher Erik Hatcher
            Reporter:
            rchyla Roman Chyla
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development