Solr搜索忽略正斜杠

时间:2015-07-23 08:34:25

标签: solr solr-query-syntax

我的字段为categoryName的solr模式为string,其具有如下的分层数据 Fruits & Vegetables/Fruits Fruits & Vegetables/Vegetables categoryName字段具有以下fieldType

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
        <!-- 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.LowerCaseFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

当我只想搜索蔬菜这里是我的查询

/query?q=categoryName:Vegetables

这为我提供了所有类别,包括Fruits

/query?q=(categoryName:/Vegetables/) 这给了我所有类别,包括Fruits,以下是调试

"rawquerystring": "(categoryName:/Vegetables/)",
"querystring": "(categoryName:/Vegetables/)",
"parsedquery": "RegexpQuery(categoryName:/vegetables/)",
"parsedquery_toString": "categoryName:/vegetables/"

/query?q=categoryName:/\/Vegetables/ 这给了我所有类别,包括Fruits,以下是调试

"rawquerystring": "(categoryName:/\\/Vegetables/)",
"querystring": "(categoryName:/\\/Vegetables/)",
"parsedquery": "RegexpQuery(categoryName:/\\/vegetables/)",
"parsedquery_toString": "categoryName:/\\/vegetables/"

/query?q=(categoryName:/Vegetables$/) 这给了我零结果,以下是调试

"rawquerystring": "(categoryName:/*Vegetables$/)",
"querystring": "(categoryName:/*Vegetables$/)",
"parsedquery": "RegexpQuery(categoryName:/*vegetables$/)",
"parsedquery_toString": "categoryName:/*vegetables$/"

获取蔬菜类独家文件的正确方法是什么?或水果

0 个答案:

没有答案