Solr带状疱疹匹配

时间:2015-03-27 11:52:05

标签: solr

我目前正在处理自动完成小部件。我也想用它来选择页面上的方面。我的一个DB facet表看起来像这样:

id | name
1  | Lace
2  | Super Fine
3  | Fine
4  | Light
5  | Medium
6  | Bulky
7  | Super bulky

以下是我所期望的一些例子,左栏是用户提供的文字,右栏是Solr的结果:

1) word1...wordn super             => Super Fine, Super Bulky
2) super word1...wordn             => --- (nothing should be found)
3) word1 super fine                => Super Fine
4) word1 super fine word2...wordn  => Super Fine
5) word1...wordn super fine        => Super Fine
6) word1 super word2...wordn fine  => Fine

所以我几乎就在那里,但案例6)并不适合我,即。 Solr发现Super Fine而不是Fine。

这是我在admin中看到的 - >架构浏览器 - > 热门词汇

2  |  super
   |  bulky
   |  fine
1  |  super bulky
   |  medium
   |  super fine
   |  light
   |  lace

查询参数:

http://localhost:8983/solr/collection1/select?q=word1+super+word2+fine&fl=group_name&df=group_name&wt=xml&indent=true&debugQuery=true&defType=edismax&qf=group_name&mm=2&pf=group_name&ps=1&qs=1&pf2=group_name&stopwords=true&lowercaseOperators=true

查询调试日志:

  <str name="rawquerystring">word1 super word2 fine</str>
  <str name="querystring">word1 super word2 fine</str>
  <str name="parsedquery">(+((DisjunctionMaxQuery((group_name:word1)) DisjunctionMaxQuery((group_name:super)) DisjunctionMaxQuery((group_name:word2)) DisjunctionMaxQuery((group_name:fine)))~2) DisjunctionMaxQuery((group_name:"word1 super word2 fine"~1)) (DisjunctionMaxQuery((group_name:"word1 super"~1)) DisjunctionMaxQuery((group_name:"super word2"~1)) DisjunctionMaxQuery((group_name:"word2 fine"~1))))/no_coord</str>
  <str name="parsedquery_toString">+(((group_name:word1) (group_name:super) (group_name:word2) (group_name:fine))~2) (group_name:"word1 super word2 fine"~1) ((group_name:"word1 super"~1) (group_name:"super word2"~1) (group_name:"word2 fine"~1))</str>
  <lst name="explain">
    <str name="portal.group.2">
0.29696858 = (MATCH) sum of:
  0.29696858 = (MATCH) product of:
    0.59393716 = (MATCH) sum of:
      0.29696858 = (MATCH) weight(group_name:super in 1) [DefaultSimilarity], result of:
        0.29696858 = score(doc=1,freq=1.0 = termFreq=1.0
), product of:
          0.15038839 = queryWeight, product of:
            3.1594841 = idf(docFreq=2, maxDocs=26)
            0.047599033 = queryNorm
          1.9746776 = fieldWeight in 1, product of:
            1.0 = tf(freq=1.0), with freq of:
              1.0 = termFreq=1.0
            3.1594841 = idf(docFreq=2, maxDocs=26)
            0.625 = fieldNorm(doc=1)
      0.29696858 = (MATCH) weight(group_name:fine in 1) [DefaultSimilarity], result of:
        0.29696858 = score(doc=1,freq=1.0 = termFreq=1.0
), product of:
          0.15038839 = queryWeight, product of:
            3.1594841 = idf(docFreq=2, maxDocs=26)
            0.047599033 = queryNorm
          1.9746776 = fieldWeight in 1, product of:
            1.0 = tf(freq=1.0), with freq of:
              1.0 = termFreq=1.0
            3.1594841 = idf(docFreq=2, maxDocs=26)
            0.625 = fieldNorm(doc=1)
    0.5 = coord(2/4)
</str>

和我的 schema.xml 摘录:

<fieldType name="ngram" class="solr.TextField" >
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.ShingleFilterFactory" minShingleSize="2" maxShingleSize="2"
         outputUnigrams="true" outputUnigramsIfNoShingles="false" tokenSeparator=" "/>

  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

我很感激对此有任何帮助,因为我刚刚开始与Solr合作,我想我还没有完全理解所有的概念(也许它不可能做到)在Solr我想要什么?)。

0 个答案:

没有答案