Solr 是否检测停用词的语言?

发布于 2025-01-16 20:12:31 字数 1240 浏览 4 评论 0原文

对于“dieser”或“ihren”等德语术语,停用词效果很好,但我没有得到它们的搜索结果。 但对于像“那些”或“带有”停用词这样的英语术语不起作用,我会得到搜索结果。 因为我正在索引德语和英语文档,所以我希望它们都能工作。

我正在使用 drupal 9 和搜索 API Solr(solr 8.11)。 在conf文件夹中是:stopwords_en.txt和stopwords_de.txt schema.xml 有两个 solr.TextField fieldType 元素。 它们都没有定义。停用词元素(我没有更改 schema.xml )。


    <fieldType name="text_ws" class="solr.TextField" omitNorms="true" positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

    <fieldType name="boost_term_payload" stored="false" indexed="true" class="solr.TextField" >
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LengthFilterFactory" min="2" max="100"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/>
      </analyzer>
    </fieldType>

我已经尝试定义一个带有停用词的过滤器,但没有成功。但是,如果 schema.xml 中没有定义过滤器,为什么它对德语有效呢?

Stopwords are working fine for german terms like 'dieser' or 'ihren', I get no search results for them.
But for english terms like 'those' or 'with' stopwords are not working, I get search results.
Because I'am indexing german and english documents I would like them both to work.

I am working with drupal 9 and Search API Solr(solr 8.11).
In conf folder is : stopwords_en.txt and stopwords_de.txt
The schema.xml has two solr.TextField fieldType elements.
None of them defines a <filter> element for stopwords( I didn't change the schema.xml ).


    <fieldType name="text_ws" class="solr.TextField" omitNorms="true" positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

    <fieldType name="boost_term_payload" stored="false" indexed="true" class="solr.TextField" >
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LengthFilterFactory" min="2" max="100"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/>
      </analyzer>
    </fieldType>

I already tried to define a filter with stopwords without scuccess. But why is it working for german if no filter is defined in schema.xml?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文