<i id='MAA4V'><tr id='MAA4V'><dt id='MAA4V'><q id='MAA4V'><span id='MAA4V'><b id='MAA4V'><form id='MAA4V'><ins id='MAA4V'></ins><ul id='MAA4V'></ul><sub id='MAA4V'></sub></form><legend id='MAA4V'></legend><bdo id='MAA4V'><pre id='MAA4V'><center id='MAA4V'></center></pre></bdo></b><th id='MAA4V'></th></span></q></dt></tr></i><div id='MAA4V'><tfoot id='MAA4V'></tfoot><dl id='MAA4V'><fieldset id='MAA4V'></fieldset></dl></div>

<legend id='MAA4V'><style id='MAA4V'><dir id='MAA4V'><q id='MAA4V'></q></dir></style></legend>
    <bdo id='MAA4V'></bdo><ul id='MAA4V'></ul>

    1. <tfoot id='MAA4V'></tfoot>

        <small id='MAA4V'></small><noframes id='MAA4V'>

        Solr:结合 EdgeNGramFilterFactory 和 NGramFilterFactory

        时间:2023-06-28

        <small id='ajOqn'></small><noframes id='ajOqn'>

        <tfoot id='ajOqn'></tfoot>
        1. <i id='ajOqn'><tr id='ajOqn'><dt id='ajOqn'><q id='ajOqn'><span id='ajOqn'><b id='ajOqn'><form id='ajOqn'><ins id='ajOqn'></ins><ul id='ajOqn'></ul><sub id='ajOqn'></sub></form><legend id='ajOqn'></legend><bdo id='ajOqn'><pre id='ajOqn'><center id='ajOqn'></center></pre></bdo></b><th id='ajOqn'></th></span></q></dt></tr></i><div id='ajOqn'><tfoot id='ajOqn'></tfoot><dl id='ajOqn'><fieldset id='ajOqn'></fieldset></dl></div>

          1. <legend id='ajOqn'><style id='ajOqn'><dir id='ajOqn'><q id='ajOqn'></q></dir></style></legend>
                <bdo id='ajOqn'></bdo><ul id='ajOqn'></ul>
                    <tbody id='ajOqn'></tbody>
                  本文介绍了Solr:结合 EdgeNGramFilterFactory 和 NGramFilterFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我遇到需要同时使用 EdgeNGramFilterFactory 和 NGramFilterFactory 的情况.

                  I have a situation where I need to use both EdgeNGramFilterFactory and NGramFilterFactory.

                  我正在使用 NGramFilterFactory 执行包含"样式搜索,最小字符数为 2.我还想搜索第一个字母,例如带有前端 EdgeNGramFilterFactory 的startswith".

                  I am using NGramFilterFactory to perform a "contains" style search with min number of characters as 2. I also want to search for the first letter, like a "startswith" with a front EdgeNGramFilterFactory.

                  我不想将 NGramFilterFactory 降低到最少 1 个字符,因为我不想索引所有字符.

                  I dont want to lower the NGramFilterFactory to min characters of 1 as I dont want to index all characters.

                  非常感谢您的帮助

                  干杯

                  推荐答案

                  你不一定要在同一个领域做所有这些.我会为每种处理使用不同的自定义类型创建不同的字段,以便您可以单独应用逻辑.

                  You don't necessarily have to do all this in the same field. I would create a different fields using different custom types for each treatment so that you can apply the logic separately.

                  如下:

                  • text 包含原始标记,经过最少处理;
                  • text_ngram 使用 NGramFilter 处理最少两个字符的标记
                  • text_first_letter 使用 EdgeNGram 作为单字符首字母标记
                  • text contains the original tokens, minimally processed;
                  • text_ngram uses the NGramFilter for your two-character-minimum tokens
                  • text_first_letter uses EdgeNGram for your one-character initial-letter tokens

                  如果您以这种方式处理所有 text 字段,那么您也许可以使用 copyField 来填充字段.否则,您可以指示 Solr 客户端为三种不同的字段类型发送相同的字段值.

                  If you're processing all text fields in this way, then you might be able to get away with using a copyField to populate the fields. Otherwise, you can instruct your Solr client to send in the same field values for the three separate field types.

                  搜索时,使用 qf 参数将所有这些都包含在搜索中.

                  When searching, include all of them in your searches with the qf parameter.

                  <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
                    <analyzer>
                      <tokenizer class="solr.StandardTokenizerFactory"/>
                      <filter class="solr.StandardFilterFactory"/>
                      <filter class="solr.LowerCaseFilterFactory"/>
                    </analyzer>
                  </fieldType>
                  
                  <fieldType name="text_ngram" class="solr.TextField" positionIncrementGap="100">
                    <analyzer>
                      <tokenizer class="solr.StandardTokenizerFactory"/>
                      <filter class="solr.StandardFilterFactory"/>
                      <filter class="solr.LowerCaseFilterFactory"/>
                      <filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/>
                    </analyzer>
                  </fieldType>
                  
                  <fieldType name="text_first_letter" class="solr.TextField" positionIncrementGap="100">
                    <analyzer>
                      <tokenizer class="solr.StandardTokenizerFactory"/>
                      <filter class="solr.StandardFilterFactory"/>
                      <filter class="solr.LowerCaseFilterFactory"/>
                      <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="1" side="front"/>
                    </analyzer>
                  </fieldType>
                  

                  设置 fielddynamicField 定义由您决定.或者,如果您有更多问题,请告诉我,我可以进行编辑并进行澄清.

                  Setting up field and dynamicField definitions are left up to you. Or let me know if you have more questions and I can edit with clarifications.

                  这篇关于Solr:结合 EdgeNGramFilterFactory 和 NGramFilterFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:向 Lucene 文档添加多值字符串字段,逗号重要吗? 下一篇:如何对用 lucene 索引的文档进行分类

                  相关文章

                    <i id='L29cU'><tr id='L29cU'><dt id='L29cU'><q id='L29cU'><span id='L29cU'><b id='L29cU'><form id='L29cU'><ins id='L29cU'></ins><ul id='L29cU'></ul><sub id='L29cU'></sub></form><legend id='L29cU'></legend><bdo id='L29cU'><pre id='L29cU'><center id='L29cU'></center></pre></bdo></b><th id='L29cU'></th></span></q></dt></tr></i><div id='L29cU'><tfoot id='L29cU'></tfoot><dl id='L29cU'><fieldset id='L29cU'></fieldset></dl></div>
                    • <bdo id='L29cU'></bdo><ul id='L29cU'></ul>

                    <tfoot id='L29cU'></tfoot>

                    1. <legend id='L29cU'><style id='L29cU'><dir id='L29cU'><q id='L29cU'></q></dir></style></legend>

                    2. <small id='L29cU'></small><noframes id='L29cU'>