[ 
https://issues.apache.org/jira/browse/SOLR-5521?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bill Mitchell updated SOLR-5521:
--------------------------------

    Attachment: SOLR-5521.4.2.1.patch

I have attached a patch, against 4.2.1 as that is the version we are running 
locally, which escapes MLT ids and query terms when passing derivative queries 
to each shard.  It thus fixes the symptom identified above, as well as the 
similar problem mentioned in the comments to SOLR-788.    

The patch includes a test in DistributedMLTComponentTest, although to verify it 
you have to remove the Ignore annotation that skips the test to accommodate 
freebsd.  

> 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
>         Attachments: SOLR-5521.4.2.1.patch
>
>
> 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]

Reply via email to