• <small id='oBYdO'></small><noframes id='oBYdO'>

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

        Solr:结合 EdgeNGramFilterFactory 和 NGramFilterFactory

        时间:2023-09-29

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

              <bdo id='wJ54S'></bdo><ul id='wJ54S'></ul>

                <legend id='wJ54S'><style id='wJ54S'><dir id='wJ54S'><q id='wJ54S'></q></dir></style></legend><tfoot id='wJ54S'></tfoot>
              1. <i id='wJ54S'><tr id='wJ54S'><dt id='wJ54S'><q id='wJ54S'><span id='wJ54S'><b id='wJ54S'><form id='wJ54S'><ins id='wJ54S'></ins><ul id='wJ54S'></ul><sub id='wJ54S'></sub></form><legend id='wJ54S'></legend><bdo id='wJ54S'><pre id='wJ54S'><center id='wJ54S'></center></pre></bdo></b><th id='wJ54S'></th></span></q></dt></tr></i><div id='wJ54S'><tfoot id='wJ54S'></tfoot><dl id='wJ54S'><fieldset id='wJ54S'></fieldset></dl></div>
                  <tbody id='wJ54S'></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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

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

                  相关文章

                  最新文章

                    <bdo id='N7MFI'></bdo><ul id='N7MFI'></ul>
                • <legend id='N7MFI'><style id='N7MFI'><dir id='N7MFI'><q id='N7MFI'></q></dir></style></legend>
                • <small id='N7MFI'></small><noframes id='N7MFI'>

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