You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/09/02 14:25:10 UTC

[GitHub] [lucene-solr] bruno-roustant commented on a change in pull request #1819: SOLR-14782: Document how to unescape for the QueryElevationComponent.

bruno-roustant commented on a change in pull request #1819:
URL: https://github.com/apache/lucene-solr/pull/1819#discussion_r482110458



##########
File path: solr/solr-ref-guide/src/the-query-elevation-component.adoc
##########
@@ -61,7 +61,18 @@ Optionally, in the Query Elevation Component configuration you can also specify
 The Query Elevation Search Component takes the following parameters:
 
 `queryFieldType`::
-Specifies which fieldType should be used to analyze the incoming text. For example, it may be appropriate to use a fieldType with a LowerCaseFilter.
+Specifies which fieldType should be used to analyze the incoming text. For example, it may be appropriate to use a fieldType with a LowerCaseFilter. Other example, if you need to unescape backslash-escaped queries, then you can define the fieldType to preprocess with a PatternReplaceCharFilter. Here is the corresponding example of fieldType (traditionally in `schema.xml`):
+
+[source,xml]
+----
+<fieldType name="unescapelowercase" class="solr.TextField">
+  <analyzer>
+    <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="\\(.)" replacement="$1"/>

Review comment:
       Indeed, but do we want to go into this level of detail?
   The Lucene StandardQueryParser uses EscapeQuerySyntaxImpl.discardEscapeChar() which unescape everything without distinction except it detects unicode \uxxxx and converts it.
   I suggest that we give a basic example of unescaping every backslash. If the user wants more sophisticated logic, then she will design the right pattern or the custom CharFilter.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org