Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9574

factor out AbstractReRankQuery class

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.3, master (7.0)
    • Component/s: None
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

      Motivation is to avoid unnecessary code duplication between ReRankQParserPlugin and the SOLR-8542 plugin.

      1. SOLR-9574.patch
        7 kB
        Christine Poerschke

        Issue Links

          Activity

          Hide
          cpoerschke Christine Poerschke added a comment -

          Attaching proposed patch. In this code snippet here

          public Query rewrite(IndexReader reader) throws IOException {
            Query q = mainQuery.rewrite(reader);
            if (q != mainQuery) {
              return rewrite(q);
            }
            return super.rewrite(reader);
          }
          
          protected abstract Query rewrite(Query rewrittenMainQuery) throws IOException;
          ...
          protected Query rewrite(Query rewrittenMainQuery) throws IOException {
            return new ReRankQuery(reRankQuery, reRankDocs, reRankWeight).wrap(rewrittenMainQuery);
          }
          

          i could see the abstract method being called something else (what though?) but the wrap call i think should definitely go in the abstract method since something like

          protected Query rewrite(Query rewrittenMainQuery) throws IOException {
            return new MyReRankQuery(rewrittenMainQuery, reRankQuery, reRankDocs, reRankWeight);
          }
          

          would be a valid implementation.

          Show
          cpoerschke Christine Poerschke added a comment - Attaching proposed patch. In this code snippet here public Query rewrite(IndexReader reader) throws IOException { Query q = mainQuery.rewrite(reader); if (q != mainQuery) { return rewrite(q); } return super .rewrite(reader); } protected abstract Query rewrite(Query rewrittenMainQuery) throws IOException; ... protected Query rewrite(Query rewrittenMainQuery) throws IOException { return new ReRankQuery(reRankQuery, reRankDocs, reRankWeight).wrap(rewrittenMainQuery); } i could see the abstract method being called something else (what though?) but the wrap call i think should definitely go in the abstract method since something like protected Query rewrite(Query rewrittenMainQuery) throws IOException { return new MyReRankQuery(rewrittenMainQuery, reRankQuery, reRankDocs, reRankWeight); } would be a valid implementation.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit dbc29c0adc232636d442c6726ae27f07bdbf75e3 in lucene-solr's branch refs/heads/master from Christine Poerschke
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=dbc29c0 ]

          SOLR-9574: Factor out AbstractReRankQuery from ReRankQParserPlugin's private ReRankQuery.

          Show
          jira-bot ASF subversion and git services added a comment - Commit dbc29c0adc232636d442c6726ae27f07bdbf75e3 in lucene-solr's branch refs/heads/master from Christine Poerschke [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=dbc29c0 ] SOLR-9574 : Factor out AbstractReRankQuery from ReRankQParserPlugin's private ReRankQuery.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 031de301c211164572bd52925c668cfed01927aa in lucene-solr's branch refs/heads/branch_6x from Christine Poerschke
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=031de30 ]

          SOLR-9574: Factor out AbstractReRankQuery from ReRankQParserPlugin's private ReRankQuery.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 031de301c211164572bd52925c668cfed01927aa in lucene-solr's branch refs/heads/branch_6x from Christine Poerschke [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=031de30 ] SOLR-9574 : Factor out AbstractReRankQuery from ReRankQParserPlugin's private ReRankQuery.

            People

            • Assignee:
              cpoerschke Christine Poerschke
              Reporter:
              cpoerschke Christine Poerschke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development