Solr
  1. Solr
  2. SOLR-2636

Explain doesn't deal with negative only queries completely correctly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.4
    • Component/s: search
    • Labels:
      None

      Description

      If you do a negative only query, such as -author:[* TO *], explain returns NaN for the score. The query executes correctly, however.

      To execute negative only queries, Solr calls QueryUtils.makeQueryable, and everything works correctly. But explain doesn't call this, and coord ends up dividing by zero.

      One could fix this by fixing the call to explain, which is easy, or perhaps by fixing the query parser to generate the query that way in the first place. (It looks like extended dismax does the latter, and so shouldn't have problems).

      1. SOLR-2636
        0.7 kB
        Tom Hill

        Issue Links

          Activity

          Hide
          Tom Hill added a comment -

          Trivial patch which just fixes the call to explain.

          Show
          Tom Hill added a comment - Trivial patch which just fixes the call to explain.
          Hide
          Tom Hill added a comment -

          @hoss Shall I close this one?

          @yonik Would it make sense for SolrQueryParser to just call makeQueryable?

          @Override
          public Query parse(String query) throws ParseException

          { return QueryUtils.makeQueryable(super.parse(query)); }

          Then the other three calls to makeQueryable can be deleted, I think. And it fixes the problem with expain.

          Show
          Tom Hill added a comment - @hoss Shall I close this one? @yonik Would it make sense for SolrQueryParser to just call makeQueryable? @Override public Query parse(String query) throws ParseException { return QueryUtils.makeQueryable(super.parse(query)); } Then the other three calls to makeQueryable can be deleted, I think. And it fixes the problem with expain.
          Hide
          Yonik Seeley added a comment -

          @yonik Would it make sense for SolrQueryParser to just call makeQueryable?

          I don't think so... it's useful to be able to parse negative queries, either for fragments to add into a larger query (think bq in dismax, etc). Also, the filter query code sees negative queries and looks them up (and caches them) as their positive counterpart (so fq=foo and fq=-foo will only take up a single cache entry).

          I think your patch is fine.

          Show
          Yonik Seeley added a comment - @yonik Would it make sense for SolrQueryParser to just call makeQueryable? I don't think so... it's useful to be able to parse negative queries, either for fragments to add into a larger query (think bq in dismax, etc). Also, the filter query code sees negative queries and looks them up (and caches them) as their positive counterpart (so fq=foo and fq=-foo will only take up a single cache entry). I think your patch is fine.
          Hide
          Robert Muir added a comment -

          bulk close for 3.4

          Show
          Robert Muir added a comment - bulk close for 3.4

            People

            • Assignee:
              Yonik Seeley
              Reporter:
              Tom Hill
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development