2016-06-17 14 views
0

elasticsearch2.3.3 및 Nest 2.3.2를 사용하여 첨부 파일에 대한 색인을 만들었습니다. 색인 생성은 아래에 나와 있습니다. 문서에서 복수형을 사용하여 단수의 단어를 검색하고 있습니다.이 스노볼 스 트리머가 이러한 유형의 변환을 수행합니다. 그러나 search.As 거기에 추가로 플러그인/단어 컬렉션을 작동시키기 위해 응용 프로그램에 추가해야합니다 반환 된 기록했다. 누구든지 도와 줄 수 있어요.Snowball stemmer가 작동하지 않습니다.

{ 
"mydocs":{ 
    "aliases":{ 

    }, 
    "mappings":{ 
    "indexdocument":{ 
     "properties":{ 
      "docLocation":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "store":true 
      }, 
      "documentType":{ 
       "type":"string", 
       "store":true 
      }, 
      "file":{ 
       "type":"attachment", 
       "fields":{ 
       "content":{ 
        "type":"string" 
       }, 
       "author":{ 
        "type":"string" 
       }, 
       "title":{ 
        "type":"string", 
        "term_vector":"with_positions_offsets", 
        "analyzer":"full" 
       }, 
       "name":{ 
        "type":"string" 
       }, 
       "date":{ 
        "type":"date", 
        "format":"strict_date_optional_time||epoch_millis" 
       }, 
       "keywords":{ 
        "type":"string" 
       }, 
       "content_type":{ 
        "type":"string" 
       }, 
       "content_length":{ 
        "type":"integer" 
       }, 
       "language":{ 
        "type":"string" 
       } 
       } 
      }, 
      "id":{ 
       "type":"double", 
       "store":true 
      }, 
      "lastModifiedDate":{ 
       "type":"date", 
       "store":true, 
       "format":"strict_date_optional_time||epoch_millis" 
      }, 
      "title":{ 
       "type":"string", 
       "store":true, 
       "term_vector":"with_positions_offsets" 
      } 
     } 
    } 
    }, 
    "settings":{ 
    "index":{ 
     "creation_date":"1466180794989", 
     "analysis":{ 
      "filter":{ 
       "nGram":{ 
       "min_gram":"2", 
       "side":"front", 
       "type":"edge_ngram", 
       "max_gram":"20" 
       } 
      }, 
      "analyzer":{ 
       "partial":{ 
       "filter":[ 
        "standard", 
        "asciifolding", 
        "lowercase", 
        "snowball" 
       ], 
       "type":"custom", 
       "tokenizer":"nGram" 
       }, 
       "full":{ 
       "filter":[ 
        "standard", 
        "asciifolding", 
        "lowercase", 
        "snowball", 
        "nGram" 
       ], 
       "type":"custom", 
       "tokenizer":"standard" 
       } 
      } 
     }, 
     "number_of_shards":"5", 
     "number_of_replicas":"1", 
     "uuid":"tc-yTpbIQGeGDMOOMspf_g", 
     "version":{ 
      "created":"2030399" 
     } 
    } 
    }, 
    "warmers":{ 

    } 
} 
} 

나는 또한 stemmer_override를 시도했다. 그러나 운 없음

+0

아무도 나를 도와주세요 반환합니다. 더 많은 설명이 필요한지 알려주십시오. 나는 elasticsearch에서 새로운 –

답변

0

나는이 문제를 발견했다. 분석기가 첨부 파일 필드로 설정되어 있지 않습니다.

var fullNameFilters = new List<string> { "lowercase", "snowball" }; 
     client.CreateIndex("mydocs", c => c 
       .Settings(st => st 
         .Analysis(anl => anl 
         .Analyzers(h => h 
          .Custom("full", ff => ff 
           .Filters(fullNameFilters) 
           .Tokenizer("standard")) 
          ) 
          .TokenFilters(ba => ba 
           .Snowball("snowball", sn => sn 
            .Language(SnowballLanguage.English)))      
          )) 
         .Mappings(mp => mp 
         .Map<IndexDocument>(ms => ms 
         .AutoMap() 
         .Properties(ps => ps 
          .Nested<Attachment>(n => n 
           .Name(sc => sc.File) 
          .AutoMap() 
          )) 
         .Properties(at => at 
         .Attachment(a => a.Name(o => o.File) 
         .FileField(fl=>fl.Analyzer("full")) 
         .TitleField(t => t.Name(x => x.Title) 
         .Analyzer("full") 
         .TermVector(TermVectorOption.WithPositionsOffsets) 
         ))) 

         ))       
         ); 

에서 http : 로컬 호스트 : 9200/mydocs 다음은

{ 
"mydocs":{ 
    "aliases":{ 

    }, 
    "mappings":{ 
    "indexdocument":{ 
     "properties":{ 
      "docLocation":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "store":true 
      }, 
      "documentType":{ 
       "type":"string", 
       "store":true 
      }, 
      "file":{ 
       "type":"attachment", 
       "fields":{ 
       "content":{ 
        "type":"string", 
        "analyzer":"full" 
       }, 
       "author":{ 
        "type":"string" 
       }, 
       "title":{ 
        "type":"string", 
        "term_vector":"with_positions_offsets", 
        "analyzer":"full" 
       }, 
       "name":{ 
        "type":"string" 
       }, 
       "date":{ 
        "type":"date", 
        "format":"strict_date_optional_time||epoch_millis" 
       }, 
       "keywords":{ 
        "type":"string" 
       }, 
       "content_type":{ 
        "type":"string" 
       }, 
       "content_length":{ 
        "type":"integer" 
       }, 
       "language":{ 
        "type":"string" 
       } 
       } 
      }, 
      "filePermissionInfo":{ 
       "properties":{ 
       "accessControlType":{ 
        "type":"string", 
        "store":true 
       }, 
       "accountValue":{ 
        "type":"string", 
        "store":true 
       }, 
       "fileSystemRights":{ 
        "type":"string", 
        "store":true 
       }, 
       "isInherited":{ 
        "type":"string", 
        "store":true 
       } 
       } 
      }, 
      "id":{ 
       "type":"double", 
       "store":true 
      }, 
      "lastModifiedDate":{ 
       "type":"date", 
       "store":true, 
       "format":"strict_date_optional_time||epoch_millis" 
      }, 
      "title":{ 
       "type":"string", 
       "store":true, 
       "term_vector":"with_positions_offsets" 
      } 
     } 
    } 
    }, 
    "settings":{ 
    "index":{ 
     "creation_date":"1466482894271", 
     "analysis":{ 
      "filter":{ 
       "snowball":{ 
       "type":"snowball", 
       "language":"English" 
       } 
      }, 
      "analyzer":{ 
       "full":{ 
       "filter":[ 
        "lowercase", 
        "snowball" 
       ], 
       "type":"custom", 
       "tokenizer":"standard" 
       } 
      } 
     }, 
     "number_of_shards":"5", 
     "number_of_replicas":"1", 
     "uuid":"PpxcRl29QTCPtFcsd3PHtw", 
     "version":{ 
      "created":"2030399" 
     } 
    } 
    }, 
    "warmers":{ 

    } 
    } 
}