0

我有带有字段categoryName的solr 架构,string它具有如下的分层数据 Fruits & Vegetables/Fruits Fruits & Vegetables/Vegetables categoryName字段具有以下字段类型

<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$/"

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

4

0 回答 0