When doing a "contains" filter query, if the value entered for the field contains spaces, the behavior is to return documents where the individual words are present in any order the field. A typical user would expect "contains" to do a phrase query, where the entire phrase occurs somewhere in the field's value. This is a long-standing issue that stems from the following line in SolrServiceImpl, which has remained untouched since the original Discovery implementation, and is present in versions 4.x through 7.0 Preview 1: https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java#L2110 Notice how it surrounds the text sent to solr with "(" and ")". This has specific meaning in solr, which differs from surrounding the text with double quotes. Surrounding with double quotes would have the expected effect of doing a phrase query. Surrounding with parentheses is equivalent to entering multiple fielded search tearms, one for each word. For example, a the solr query: title:(introduction to dspace) ...is the same as the solr query: title:introduction title:to title:dspace ...which is not the expected effect. The solution, which we have tested, is to replace the surrounding parentheses in the code referenced above, with double quotes. |