我在索爾特殊字符搜索時遇到問題。 我的文檔有一個字段「標題」,有時它可以像「泰坦尼克號 - 1999」(它有字符「 - 」)。 當我嘗試在solr中搜索「 - 」時,我收到400錯誤。我試圖逃避角色,所以我嘗試了「 - 」和「\ - 」之類的東西。隨着更改solr不會迴應我的錯誤,但它返回0結果。在索爾中搜索特殊字符
我怎麼能在Solr管理與特殊字符搜索(類似於「 - 」或「'」 ???
問候
UPDATE 在這裏你可以看到我目前的Solr的方案https://gist.github.com/cpalomaresbazuca/6269375
我搜索到外地 「標題」 從schema.xml中
摘要:
...
<!-- A general text field that has reasonable, generic
cross-language defaults: it tokenizes with StandardTokenizer,
removes stop words from case-insensitive "stopwords.txt"
(empty by default), and down cases. At query time only, it
also applies synonyms. -->
<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" />
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<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.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
...
<field name="Title" type="text_general" indexed="true" stored="true"/>
當您搜索時,是否將引號括起來?像選擇?q =標題:「泰坦尼克號 - 1999」。把它放在引號中應該做一個確切的搜索 –
你的模式在這個領域看起來像什麼?我很想知道你對這個領域有什麼樣的定義。 –
<字段名=「標題」類型=「text_general」存儲=「真正的」索引=「真」 /> –