The mlt component is unable to get a correct result from the Solr 4.x service.

The 'q' parameter for the 'more like this' query is based upon a 'apachesolr_document_id' which is a combination of a unique site-hash, the entity type and the unique id delimited by forward slashes.

Since the latest Lucene version the forward slash has become a special character and needs to be escaped. https://issues.apache.org/jira/browse/LUCENE-3982

I've created a patch which adds the forward slash to the escape characters list and actually uses that provided function (I couldn't find any prior usage?).

In order not to break anything I might not be aware of the escaping will only occur on '?q:id=VALUE-TO-ESCAPE' alike queries. If we were to escape every 'q' parameter, we would lose phrase searches and so on...

There'll probably be a better place to perform such an 'escape' check, so please review.

Comments

Status: Needs review » Needs work

The last submitted patch, apachesolr-solr4-escape-characters-mlt.patch, failed testing.

smokris’s picture

Issue summary: View changes
StatusFileSize
new1.75 KB

Works for me. Thanks, Yannick Van Gansen!

Re-rolled to apply to latest 7.x-1.x-dev (and 7.x-1.6).

nick_vh’s picture

Status: Needs work » Needs review

is this only the case for the identifier? Can you show some documentation where this is from? Patch looks ok

Status: Needs review » Needs work

The last submitted patch, 2: apachesolr-solr4-escape-characters-mlt-1868434-2.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: apachesolr-solr4-escape-characters-mlt-1868434-2.patch, failed testing.

The last submitted patch, 2: apachesolr-solr4-escape-characters-mlt-1868434-2.patch, failed testing.