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

MoreLikeThis component fails when item id is negative (begins with hyphen)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.2.1
    • None
    • MoreLikeThis
    • None

    Description

      When the compared document's unique id is negative, the MoreLikeThis component fails to generate a valid query to pass to each shard, as the generated query does not encapsulate the item's negative id with quotes. In our case, we are adding documents with a negative id as temporary beans, used just for the MLT query, which will be deleted later.

      You can see this with a rather simple MLT query:
      http://lga-sppsolrprod01.pulse.prod/solr/rawContents/select?mlt=true&q=itemId:-1578997856&mlt.fl=text&mlt.count=100

      where the returned response shows:
      <response><lst name="responseHeader"><int name="status">400</int><int name="QTime">3</int><lst name="params"><str name="mlt.count">100</str><str name="mlt.fl">text</str><str name="q">itemId:1578997856</str><str name="mlt">true</str></lst></lst><lst name="error"><str name="msg">org.apache.solr.search.SyntaxError: Cannot parse 'itemId:-1578997856': Encountered " "" "- "" at line 1, column 7.
      Was expecting one of:
      <BAREOPER> ...
      "(" ...
      "*" ...
      <QUOTED> ...
      <TERM> ...
      <PREFIXTERM> ...
      <WILDTERM> ...
      <REGEXPTERM> ...
      "[" ...
      "{" ...
      <LPARAMS> ...
      <NUMBER> ...
      </str><int name="code">400</int></lst></response>

      Attachments

        1. SOLR-5521.4.2.1.patch
          7 kB
          Bill Mitchell

        Issue Links

          Activity

            People

              Unassigned Unassigned
              wtmitchell3 Bill Mitchell
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: