我正在使用“text_general”字段类型在 SOLR 中进行搜索。在使用特殊字符进行搜索时,我没有得到正确的结果并出现错误。我想使用这样的特殊字符:
-
&
+
询问
solr?q=Healing - Live
solr?q=Healing & Live
错误信息
客户端发送的请求在语法上不正确(org.apache.lucene.queryParser.ParseException: Cannot parse '("Healing \': Lexical error at line 1, column 8. Encountered: after : "\"Healing \")。
架构.xml
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.ASCIIFoldingFilterFactory" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.ASCIIFoldingFilterFactory" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<field name="title" type="text_general" indexed="true" stored="true" />
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
<defaultSearchField>text</defaultSearchField>
<copyField source="title" dest="text"/>