Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-2339

Searching produces ParseException with Lucene special char as input

    XMLWordPrintable

    Details

    • Attachments:
      0
    • Comments:
      1
    • Documentation Status:
      Not Required

      Description

      When searching in the default Solr/Lucene search with inputs such as "{", "(" and "\" the search fails with ISE.

      This is due to the Solr app not escaping the characters when passing them to Solr.

      The raw Solr errors are the following:

      Caused by: org.apache.solr.parser.ParseException: Encountered "<EOF>" at line 1, column 1.
      Was expecting one of:
      <RANGE_QUOTED> ...
      <RANGE_GOOP> ...

      and

      ERROR org.apache.solr.core.SolrCore – org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError: Cannot parse '{': Encountered "<EOF>" at line 1, column 1.
      Was expecting one of:
      <RANGE_QUOTED> ...
      <RANGE_GOOP> ...

      I could not locate the code responsible for passing the input to Solr, but this should be a quick fix by using this method: http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/client/solrj/util/ClientUtils.html#escapeQueryChars(java.lang.String)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tdonohue Tim Donohue
              Reporter:
              titusland Sean Xiao
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: