1

我一直在对奇怪的 Solr4.2.1 查询行为进行故障排除,但没有成功。我有包含以下字段的架构:

<field name="primaryIndustryName_en" type="text_general" indexed="true" stored="true" multiValued="false"/>

<field name="defaultSearchField" type="text_general" indexed="true" stored="false" multiValued="true"/>

defaultSearchField 是 solr.SearchHandler /select requestHandler 的默认字段 (df)

defaultSearchField 包含使用下面的 copyField 的数据

<copyField source="countryName_en" dest="defaultSearchField"/>
<copyField source="plsName_en" dest="defaultSearchField"/>
<copyField source="categoryName_en" dest="defaultSearchField"/>
<copyField source="primaryIndustryName_en" dest="defaultSearchField"/>
...etc

text_general 字段定义如下

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>  
        <filter class="solr.TrimFilterFactory"/>      
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        <filter class="solr.WordDelimiterFilterFactory"
                splitOnNumerics="1"
                splitOnCaseChange="0"
                stemEnglishPossessive="0"               
                generateWordParts="1"
                generateNumberParts="1"
                catenateWords="0"
                catenateNumbers="0"
                catenateAll="0"
                preserveOriginal="1"                
                protected="protwords.txt"/> 
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <charFilter class="solr.HTMLStripCharFilterFactory"/>        
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.TrimFilterFactory"/>                
        <filter class="solr.WordDelimiterFilterFactory"
                splitOnNumerics="1"
                splitOnCaseChange="0"
                stemEnglishPossessive="0"               
                generateWordParts="1"
                generateNumberParts="1"
                catenateWords="0"
                catenateNumbers="0"
                catenateAll="0"
                preserveOriginal="1"                
                protected="protwords.txt"/>

        <filter class="solr.HunspellStemFilterFactory"
                dictionary="en_US.dic"
                affix="en_US.aff"
                ignoreCase="true" />
      </analyzer>
    </fieldType>

现在,如果我搜索餐馆和咖啡馆和 countryId:1,我会得到正确的文件(基本上是所有“餐馆和咖啡馆”的企业)。但是,如果我明确搜索 primaryIndustryName_en:"restaurants & cafes" AND countryId:1我会得到一个空的结果列表。大写和小写首字母的行为相同。请注意,我使用的是 edismax 解析器,所有查询都是通过 SolrJ 完成的

下面是一个文档输出

<doc>
    <int name="brateCount">0</int>
    <str name="outletPrimaryName">La Maison Du Cafe (Cafe Najjar)</str>
    <str name="outletId">734</str>
    <str name="outletPhone1">+961-1-346646</str>
    <str name="outletUrl">www.lamaisonducafenajjar.com</str>
    <double name="outletAvarageRating">0.0</double>
    <str name="outletAddress">Hamra Main Street</str>
    <int name="views">0</int>
    <int name="areaId">1</int>
    <str name="facetAreaName_en">Hamra</str>
    <str name="areaName_en">Hamra</str>
    <str name="areaName_ar">Hamra</str>
    <str name="facetAreaName_ar">Hamra</str>
    <str name="areaName_fr">Hamra</str>
    <str name="facetAreaName_fr">Hamra</str>
    <int name="cityId">1</int>
    <str name="cityName_en">Beirut</str>
    <str name="facetCityName_en">Beirut</str>
    <str name="facetCityName_ar">Beirut</str>
    <str name="cityName_ar">Beirut</str>
    <str name="cityName_fr">Beirut</str>
    <str name="facetCityName_fr">Beirut</str>
    <int name="countryId">1</int>
    <str name="countryCode">LB</str>
    <str name="countryName_en">Lebanon</str>
    <str name="countryName_ar">Lebanon</str>
    <str name="countryName_fr">Lebanon</str>
    <int name="primaryIndustryId">55</int>
    <str name="primaryIndustryName_en">Restaurants & Cafes</str>
    <str name="facetPrimaryIndustryName_en">Restaurants & Cafes</str>
    <str name="primaryIndustryName_ar">Restaurants & Cafes</str>
    <str name="facetPrimaryIndustryName_ar">Restaurants & Cafes</str>
    <str name="primaryIndustryName_fr">Restaurants & Cafes</str>
    <str name="facetPrimaryIndustryName_fr">Restaurants & Cafes</str>
    <int name="primaryCategoryId">114</int>
    <str name="primaryCategoryName_en">Coffee Shops</str>
    <str name="facetPrimaryCategoryName_en">Coffee Shops</str>
    <str name="facetPrimaryCategoryName_ar">Coffee Shops</str>
    <str name="primaryCategoryName_ar">Coffee Shops</str>
    <str name="primaryCategoryName_fr">Coffee Shops</str>
    <str name="facetPrimaryCategoryName_fr">Coffee Shops</str>
    <arr name="ratingId">
      <int>10</int>
      <int>11</int>
      <int>12</int>
      <int>13</int>
      <int>15</int>
      <int>9</int>
    </arr>
    <arr name="ratingName_en">
      <str>Drinks</str>
      <str>Service</str>
      <str>Value</str>
      <str>Atmosphere</str>
      <str>Cleanliness</str>
      <str>Food</str>
    </arr>
    <arr name="ratingName_ar">
      <str>Drinks</str>
      <str>Service</str>
      <str>Value</str>
      <str>Atmosphere</str>
      <str>Cleanliness</str>
      <str>Food</str>
    </arr>
    <arr name="ratingName_fr">
      <str>Drinks</str>
      <str>Service</str>
      <str>Value</str>
      <str>Atmosphere</str>
      <str>Cleanliness</str>
      <str>Food</str>
    </arr>
    <arr name="plsId">
      <int>52</int>
      <int>53</int>
      <int>54</int>
      <int>55</int>
      <int>56</int>
      <int>58</int>
      <int>60</int>
      <int>61</int>
      <int>84</int>
      <int>85</int>
      <int>119</int>
    </arr>
    <arr name="plsName_en">
      <str>Water</str>
      <str>Juice</str>
      <str>Soft Drink</str>
      <str>Coffee</str>
      <str>Tea</str>
      <str>Smoothie</str>
      <str>Hot Chocolate</str>
      <str>Energy Drink</str>
      <str>Salad</str>
      <str>Sandwich</str>
      <str>Dessert</str>
    </arr>
    <arr name="plsName_ar">
      <str>Water</str>
      <str>Juice</str>
      <str>Soft Drink</str>
      <str>Coffee</str>
      <str>Tea</str>
      <str>Smoothie</str>
      <str>Hot Chocolate</str>
      <str>Energy Drink</str>
      <str>Salad</str>
      <str>Sandwich</str>
      <str>Dessert</str>
    </arr>
    <arr name="plsName_fr">
      <str>Water</str>
      <str>Juice</str>
      <str>Soft Drink</str>
      <str>Coffee</str>
      <str>Tea</str>
      <str>Smoothie</str>
      <str>Hot Chocolate</str>
      <str>Energy Drink</str>
      <str>Salad</str>
      <str>Sandwich</str>
      <str>Dessert</str>
    </arr>
    <long name="_version_">1441614839971577856</long></doc>

知道可能是什么问题吗?

4

1 回答 1

0

我尝试使用您正在使用的相同配置。您在查询部分为text_general添加的过滤器遇到的问题。

<filter class="solr.HunspellStemFilterFactory"
                dictionary="en_US.dic"
                affix="en_US.aff"
                ignoreCase="true" />

我删除了过滤器,它工作正常。

于 2014-01-29T10:18:51.390 回答