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

ReRankQuery rewrite method can change the QueryResultKey causing cache misses.

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      In SolrIndexSearcher class, the key used to lookup results in queryResultCache uses the original query.

      However later in createNormalizedWeight the query gets re-written, and then saved in the queryResultCache after it's re-written.

      This causes cache misses for the same query, and un-necessary inserts in the queryResultCache.

      I can reproduce this using a re-ranking query that is using a main query as a dismax query, the dismax Query could be re-written into a TermQuery, which makes sense, but will cause cache misses.

      I tested a quick solution by just using q.clone() when it comes to build QueryResultKey, and it works fine, but not sure if that is the best way of doing it.

      Attachments

        1. SOLR-7689.patch
          5 kB
          Joel Bernstein
        2. SOLR-7689.patch
          5 kB
          Joel Bernstein
        3. SOLR-7689.patch
          6 kB
          Joel Bernstein
        4. SOLR-7689.patch
          5 kB
          Joel Bernstein
        5. SOLR-7689.patch
          0.6 kB
          Joel Bernstein

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jbernste Joel Bernstein
            enashed Emad Nashed
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment