【问题标题】:difference between text_general and text_en in solr?solr 中 text_general 和 text_en 的区别?
【发布时间】:2013-06-03 05:27:09
【问题描述】:

我发现我可以为 text_general 字段使用不同语言的不同标记器/分析器。
但也存在text_en

为什么我们需要两个?

假设我们有一个亚洲语言的句子,并且该句子还包含一些英文单词。
text_general 用于句子中的亚洲单词,text_en 用于英文单词?
solr 如何索引/查询这样的句子?

【问题讨论】:

    标签: solr indexing textfield


    【解决方案1】:

    Why do we need two?

    这样您就可以对不同的内容进行不同的分析。或者,您甚至可以根据需要以不同的方式分析相同的内容(使用copyField)。这为您在查询时提供了更多关于要查询的字段的选择。

    text_general is used for the asian words in the sentence and text_en for english words?

    不可以,每个字段只能有一个fieldType,就像数据库一样。

    如果你想对同一个领域的不同语言做不同的分析,可以看SmartChineseAnalyzer的例子。

    另见http://docs.lucidworks.com/display/LWEUG/Multilingual+Indexing+and+Search

    【讨论】:

      【解决方案2】:

      text_en 使用词干,因此如果您搜索fakes,您可以匹配fakefake'sfaking 等。使用非词干字段fakes 将仅匹配fakes

      每个字段都使用不同的分析器“链”。 text_en 使用一系列过滤器来更好地索引英语。查看tokenizerfilter 条目。

      text_general 的架构摘录:

      <!-- A general text field that has reasonable, generic
           cross-language defaults: it tokenizes with StandardTokenizer,
       removes stop words from case-insensitive "stopwords.txt"
      
      <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
          <tokenizer class="solr.StandardTokenizerFactory"/>
          <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
          <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
          <filter class="solr.LowerCaseFilterFactory"/>
      

      text_en 的架构摘录:

      <!-- A text field with defaults appropriate for English: it
           tokenizes with StandardTokenizer, removes English stop words
           (lang/stopwords_en.txt), down cases, protects words from protwords.txt, and
           finally applies Porter's stemming.  The query time analyzer
           also applies synonyms from synonyms.txt. -->
      <fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
          <tokenizer class="solr.StandardTokenizerFactory"/>
          <!-- 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.StopFilterFactory"
                  ignoreCase="true"
                  words="lang/stopwords_en.txt"
                  enablePositionIncrements="true"
                  />
          <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.EnglishPossessiveFilterFactory"/>
          <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
          <filter class="solr.PorterStemFilterFactory"/>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-04-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-29
        • 2015-10-24
        相关资源
        最近更新 更多