[
https://issues.apache.org/jira/browse/SOLR-5521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13836935#comment-13836935
]
Bill Mitchell commented on SOLR-5521:
-------------------------------------
The fix that I will be testing is to go into TermQuery.toString and wrap
term.text() with quotation marks if it begins with a hyphen.
> MoreLikeThis component fails when item id is negative (begins with hyphen)
> --------------------------------------------------------------------------
>
> Key: SOLR-5521
> URL: https://issues.apache.org/jira/browse/SOLR-5521
> Project: Solr
> Issue Type: Bug
> Components: MoreLikeThis
> Affects Versions: 4.2.1
> Reporter: Bill Mitchell
> Priority: Minor
>
> 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>
--
This message was sent by Atlassian JIRA
(v6.1#6144)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]