Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Encoding solr stopwords与德语umlauts不起作用_Encoding_Solr_Filter_Lucene - Fatal编程技术网

Encoding solr stopwords与德语umlauts不起作用

Encoding solr stopwords与德语umlauts不起作用,encoding,solr,filter,lucene,Encoding,Solr,Filter,Lucene,早上好! 我对solr中的stopword过滤器有问题。我只在查询时使用该过滤器。所有stopwords都被忽略了,因为这告诉我过滤器工作得很好,…除了带有ä、ö或ü等字符的单词。 这里是my schema.xml: ..... <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <toke

早上好! 我对solr中的stopword过滤器有问题。我只在查询时使用该过滤器。所有stopwords都被忽略了,因为这告诉我过滤器工作得很好,…除了带有ä、ö或ü等字符的单词。 这里是my schema.xml:

 .....
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.SynonymFilterFactory" tokenizerFactory="solr.KeywordTokenizerFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <!--<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>-->
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="25"/>
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.HunspellStemFilterFactory" dictionary="vkf_de_DE.dic" affix="vkf_de_DE.aff" ignoreCase="true" />
    </analyzer>
</fieldType>
 .....
。。。。。
.....
在solr admin中分析诸如“zelt für messe”之类的查询短语确实正确地排除了“für”一词。但是,通过我们的websearch的所有请求都会导致solr在使用包含“ü”、“ä”或“ö”的stopword时没有结果

stopwords.txt的UTF-8编码正确

顺便说一下,我们通过一个节点api服务器处理到solr或从solr发出的请求。可能节点服务器没有使用正确的编码?但所有其他请求(例如搜索stopword列表中不包含的带ö、ä或ü的单词)都正确到达solr服务器

有什么想法吗?多谢各位


我得到了解决方案:

在我使用StopFilterFactory的一种字段类型中,还有一个charFilter,它用正则表达式替换该字段的所有非法字符。 但是像ä,ö,ü这样的特殊角色没有被考虑

将正则表达式模式从“([^a-z0-9])”更改为“([^a-z0-9öäü])”解决了我的问题

    <fieldType name="product_number" class="solr.TextField" positionIncrementGap="100">
      ....
      <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="([^a-z0-9öäü])" replacement=""/>
      ....
    </fieldType>

....
....

如果Solr admin中的所有功能都正常,那么问题肯定不是Solr.Hm的问题,是的,但当我在Solr admin(调试模式)中测试直接执行查询时,我发现“für”一词没有正确到达查询字段。这里是调试的一部分:“DisjunctionMaxQuery((productNumber:fr^84.0 | VariantProductNumber:fr^80.0 | AlternativeProductNumber:fr^85.0))”在禁用solr.HunspellStemFilterFactory时,您是否可以再试一次,这可能会破坏您的查询。将解决方案作为答案发布,以便将其标记为已回答