过滤facory以解决单数和复数单词的问题

时间:2018-06-01 07:41:32

标签: solr

我们正在使用solr 6.3,下面是我们的架构fieldType详细信息。使用此工厂,我们无法搜索以“es”,“ing”等结尾的单词。

    <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EnglishMinimalStemFilterFactory"/>
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
    <filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EnglishMinimalStemFilterFactory"/>
    </analyzer>
    </fieldType>

下面是我们搜索“切换”时的搜索示例,然后它不搜索“切换”,但这个词存在于我们的文档中。

    {
    "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"catg_name: \"switch\"",
      "indent":"on",
      "fl":"slno,catg_name",
      "rows":"5",
      "wt":"json"}},
    "response":{"numFound":371,"start":0,"docs":[
      {
        "slno":"99562",
        "catg_name":"Brake Switch"},
      {
        "slno":"101324",
        "catg_name":"Bypass Switch"},
      {
        "slno":"408940",
        "catg_name":"Switch enclosure"},
      {
        "slno":"438615",
        "catg_name":"switch phase"},
      {
        "slno":"45726",
        "catg_name":"Actuator Switch"}]
    }}

使用“开关”搜索结果

    {
    "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"catg_name: \"switches\"",
      "indent":"on",
      "fl":"slno,catg_name",
      "rows":"5",
      "wt":"json"}},
    "response":{"numFound":241,"start":0,"docs":[
      {
        "slno":"533505",
        "catg_name":"switches"},
      {
        "slno":"533507",
        "catg_name":"electronic switches"},
      {
        "slno":"390415",
        "catg_name":"arrester switches"},
      {
        "slno":"3259",
        "catg_name":"air switches"},
      {
        "slno":"3263",
        "catg_name":"control switches"}]
    }}

在这里提供更多我们在搜索中遇到问题的单词示例

  

儿童,儿童顾问,咨询,咨询锄头,锄头   马蹄铁,马铃薯土豆,土豆

为了能够通过转换为单数和复数来搜索单词,我们应该使用哪个工厂?

0 个答案:

没有答案