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

Search not working as expected

    Details

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

      Description

      DSpace 5.3 included a fix for DS-2602 (and a few other issues) related to escaping special characters in search strings. The fix appears to have had an unintended side effect in that it no longer allows the user to explicitly specify the search operator.

      In a pre-5.3 repository, it's possible to search for eg black beetle, black AND beetle, black OR beetle. By default (and assuming the repository contains items that have both query terms as well as items that contain only one of them), a search for black beetle will produce the same results as for black OR beetle, while a search for black AND beetle will have fewer results. In a 5.3 repository (reproduced on demo.dspace.org using both JSPUI and XMLUI), all three searches will have the same effect.

      The DSpace logs reveal (and for JSPUI this is visible in the user interface too) that the whitespace is escaped when the query is sent through to solr. The attached screenshot shows what happens when I search for "business OR test" (without the quotes) on the DSpace demo server.

      I believe the reason for this behaviour is that the fix for DS-2602 involves calling the escapeQueryChars method from the search service (https://github.com/DSpace/DSpace/pull/981/files#diff-8210e318a7fcfd733bbb3b4396f5f82bR229), which in turn calls Solr's own escapeQueryChars method. This method also escapes whitespace, see http://svn.apache.org/viewvc/lucene/dev/tags/lucene_solr_4_10_2/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java?view=markup line 239.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                schweer Andrea Schweer
                Reporter:
                schweer Andrea Schweer
                Reviewer:
                Tim Donohue
              • Votes:
                3 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: