Solr Fuzzy和EdgeNgrams在一起

时间:2016-06-23 10:50:05

标签: search solr fuzzy

使用EdgeNgram Filter时是否可以进行模糊搜索?

我的配置:

<field name="name" type="my_string_name" indexed="true" stored="true" omitNorms="true" />

<fieldType name="my_string_name" class="solr.TextField" positionIncrementGap="100"> 
  <analyzer> 
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory" />
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="4" maxGramSize="10" />
  </analyzer> 
</fieldType> 

从调试响应看,使用模糊搜索时,查询似乎没有扩展。任何人都可以解释究竟发生了什么吗?

现在我尝试了以下查询:

命名:安德鲁

{
  "responseHeader":{
    "status":0,
    "QTime":1,
    "params":{
      "q":"name:andrew",
      "indent":"on",
      "wt":"json",
      "debugQuery":"on",
      "_":"1466672435974"}},
  "response":{"numFound":0,"start":0,"docs":[]
  },
  "debug":{
    "rawquerystring":"name:andrew",
    "querystring":"name:andrew",
    "parsedquery":"SynonymQuery(Synonym(name:andr name:andre name:andrew))",
    "parsedquery_toString":"Synonym(name:andr name:andre name:andrew)",
    "explain":{},
    "QParser":"LuceneQParser",
    "timing":{
      "time":1.0,
      "prepare":{
        "time":0.0,
        "query":{
          "time":0.0},
        "facet":{
          "time":0.0},
        "facet_module":{
          "time":0.0},
        "mlt":{
          "time":0.0},
        "highlight":{
          "time":0.0},
        "stats":{
          "time":0.0},
        "expand":{
          "time":0.0},
        "debug":{
          "time":0.0}},
      "process":{
        "time":0.0,
        "query":{
          "time":0.0},
        "facet":{
          "time":0.0},
        "facet_module":{
          "time":0.0},
        "mlt":{
          "time":0.0},
        "highlight":{
          "time":0.0},
        "stats":{
          "time":0.0},
        "expand":{
          "time":0.0},
        "debug":{
          "time":0.0}}}}}

命名:安德鲁〜1

它返回了:

{
  "responseHeader": {
    "status": 0,
    "QTime": 1,
    "params": {
      "q": "name:andrew~1",
      "indent": "on",
      "wt": "json",
      "debugQuery": "on",
      "_": "1466672435974"
    }
  },
  "response": {
    "numFound": 0,
    "start": 0,
    "docs": []
  },
  "debug": {
    "rawquerystring": "name:andrew~1",
    "querystring": "name:andrew~1",
    "parsedquery": "name:andrew~1",
    "parsedquery_toString": "name:andrew~1",
    "explain": {},
    "QParser": "LuceneQParser",
    "timing": {
      "time": 1,
      "prepare": {
        "time": 0,
        "query": {
          "time": 0
        },
        "facet": {
          "time": 0
        },
        "facet_module": {
          "time": 0
        },
        "mlt": {
          "time": 0
        },
        "highlight": {
          "time": 0
        },
        "stats": {
          "time": 0
        },
        "expand": {
          "time": 0
        },
        "debug": {
          "time": 0
        }
      },
      "process": {
        "time": 0,
        "query": {
          "time": 0
        },
        "facet": {
          "time": 0
        },
        "facet_module": {
          "time": 0
        },
        "mlt": {
          "time": 0
        },
        "highlight": {
          "time": 0
        },
        "stats": {
          "time": 0
        },
        "expand": {
          "time": 0
        },
        "debug": {
          "time": 0
        }
      }
    }
  }
}

0 个答案:

没有答案