Xml 索尔,必须输入整个单词
我的索引中有一些条目,每个字段中有几个单词(text_general)。例如“一比三比四” 我已经做了一个jQuery自动建议查询我的索引,但是我需要从我的text_字段中键入一个单词来获得响应。例如“一”。“O”或“On”不会给我结果 以前在相同的设置下也能工作,所以我不明白为什么现在不能了。我唯一真正改变的是我索引的数据,现在我的data-config.xml中有两个实体,而不是一个 我已将几个字段复制到该字段:Xml 索尔,必须输入整个单词,xml,solr,Xml,Solr,我的索引中有一些条目,每个字段中有几个单词(text_general)。例如“一比三比四” 我已经做了一个jQuery自动建议查询我的索引,但是我需要从我的text_字段中键入一个单词来获得响应。例如“一”。“O”或“On”不会给我结果 以前在相同的设置下也能工作,所以我不明白为什么现在不能了。我唯一真正改变的是我索引的数据,现在我的data-config.xml中有两个实体,而不是一个 我已将几个字段复制到该字段: <field name="test" type="text_genera
<field name="test" type="text_general" indexed="true" stored="false" multiValued="true">
(详见下文)
我已经尝试过多值运算,但它似乎不是问题所在。有什么建议吗
这是Solr4.4
data-config.xml
<entity name="product" dataSource="sqlServer" pk="ProductID" query="SELECT
ProductID,
ProductNumber,
ProductName,
ProductShortDescription,
ProductLongDescription,
ProductPrice,
ProductFeatures,
ProductSymbols,
ProductApplications
FROM EcomProducts">
<field column="ProductID" name="Id"/>
<field column="ProductNumber" name="ProductNumber"/>
<field column="ProductName" name="Name"/>
<field column="ProductShortDescription" name="ProductShortDescription"/>
<field column="ProductLongDescription" name="ProductLongDescription"/>
<field column="ProductPrice" name="ProductPrice"/>
<field column="ProductFeatures" name="ProductFeatures"/>
<field column="ProductSymbols" name="ProductSymbols"/>
<field column="ProductApplications" name="ProductApplications"/>
</entity>
<entity name="tip" dataSource="sqlServer" pk="Id" query="SELECT
Id,
TipsContentHeader,
TipsContentText,
TipsPageId
FROM ItemType_TipsFifContent">
<field column="Id" name="Id"/>
<field column="TipsContentHeader" name="Name"/>
<field column="TipsContentText" name="TipsContentText"/>
<field column="TipsPageId" name="TipsPageId"/>
</entity>
schema.xml
<field name="Id" type="text_general" indexed="true" stored="true" required="true" />
<field name="Name" type="text_general" indexed="true" stored="true" required="false" multiValued="false" />
<field name="TipsContentText" type="text_general" indexed="true" stored="true" required="false" multiValued="false" />
<field name="TipsPageId" type="text_general" indexed="true" stored="true" required="false" />
<field name="ProductNumber" type="text_general" indexed="true" stored="true" required="false" />
<field name="ProductShortDescription" type="text_general" indexed="true" stored="true" required="false" multiValued="false" />
<field name="ProductLongDescription" type="text_general" indexed="true" stored="true" required="false" multiValued="false" />
<field name="ProductPrice" type="float" indexed="true" stored="true" required="false" />
<field name="ProductFeatures" type="text_general" indexed="true" stored="true" required="false" />
<field name="ProductSymbols" type="text_general" indexed="true" stored="true" required="false" />
<field name="ProductApplications" type="text_general" indexed="true" stored="true" required="false" />
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
<copyField source="Name" dest="text"/>
<copyField source="TipsContentText" dest="text"/>
<copyField source="ProductShortDescription" dest="text"/>
<copyField source="ProductLongDescription" dest="text"/>
<defaultSearchField>text</defaultSearchField>
文本
您需要使用N-Grams,以便在字母上找到匹配项,而不是整个单词。您可以找到一个示例我不推荐NGram tokenzier。这将显著增加索引大小。您能告诉我们您的solr查询当前的样子吗?
问题是,您在查询中没有像o*或on*那样进行通配符搜索。向solr发送的查询是什么?您可以粘贴“text\u general”的字段类型定义吗?我猜
text\u general
有一个按单词索引的WhiteSpaceFilter
,但是你在寻找NGram
过滤器?@dwhelan我在用SolrNet查询。看起来是这样的:@Aeham您可以在这里看到“text_general”的字段类型-它只是默认配置中的标准字段。你完全正确!我在代码中更改了查询,并删除了查询开头和结尾的通配符。再次插入(*q*)后,它现在再次工作,谢谢!