2009-12-29 106 views
8

我遇到了Solr和Faceting问题,并想知道是否有人知道该修复。我现在有一个工作,但我真的想弄清楚为什么我的查询不起作用。使用“字符串”字段,“文本”字段和“复制”字段对Solr进行切分

这里是我的架构,简化,使之更容易遵循:

<fields> 
    <field name="uniqueid" type="string" indexed="true" required="true"/> 
    <!-- Indexed and Stored Field ---> 
    <field name="recordtype" type="text" indexed="true" stored="true"/> 
    <!-- Facet Version of fields --> 
    <field name="frecordtype" type="string" indexed="true" stored="false"/> 
</fields> 

<!-- Copy fields for facet searches --> 
<copyField source="recordtype" dest="frecordtype"/> 

正如你可以看到我有一个区分大小写的字段名为RECORDTYPE和它被复制到一个大小写敏感领域frecordtype不记号化的文本。这是因为solr在分面结果中返回索引值而不是存储值。

当我尝试以下查询:

http://localhost:8080 
/solr 
/select 
?version=2.2 
&facet.field=%7b!ex%3dfrecordtype%7dfrecordtype 
&facet=on 
&fq=%7b!tag%3dfrecordtype%7dfrecordtype%3aLarge%20Record 
&f1=*%2cscore 
&rows=20 
&start=0 
&qt=standard 
&q=text%3a%25 

我没有得到任何结果,但是facteting仍然显示还有1分的纪录。

<result name="response" numFound="0" start="0" /> 
<lst name="facet_counts"> 
    <lst name="facet_queries" /> 
<lst name="facet_fields"> 
<lst name="frecordtype"> 
    <int name="Large Record">1</int> 
    <int name="Small Record">12</int> 
    <int name="Other">1</int> 
    </lst> 
    </lst> 
    <lst name="facet_dates" /> 
    </lst> 

但是,如果我改变fitler查询(行7只),是对 “RECORDTYPE” insted的frecordtype的:

http://localhost:8080 
/solr 
/select 
?version=2.2 
&facet.field=%7b!ex%3dfrecordtype%7dfrecordtype 
&facet=on 
&fq=%7b!tag%3dfrecordtype%7drecordtype%3aLarge%20Record 
&f1=*%2cscore 
&rows=20 
&start=0 
&qt=standard 
&q=text%3a%25 

我得到的1个结果回来,我想。

<result name="response" numFound="1" start="0" /> 
<lst name="facet_counts"> 
    <lst name="facet_queries" /> 
<lst name="facet_fields"> 
<lst name="frecordtype"> 
    <int name="Large Record">1</int> 
    <int name="Small Record">12</int> 
    <int name="Other">1</int> 
    </lst> 
    </lst> 
    <lst name="facet_dates" /> 
    </lst> 

所以我的问题是,有什么我需要做的,以获得第一个版本的查询返回我想要的结果?也许这是关于URL编码或什么的?来自某个solr guru或其他人的任何提示都将非常感激。

注意:这是不必要的一个小面的问题,因为面的实际工作。这更多的是一个查询问题,我无法在“字符串”字段上执行查询,即使大小写和间距与索引版本完全相同。

编辑:有关小平面,你可以看看这些博客文章关于它的更多信息:

感谢

戴夫

+0

Arrhhh排序了这一点......你需要引号与空间:) – CraftyFella 2009-12-29 13:58:27

回答

10

您需要引用值为

例如

frecordtype:“大型唱片”

工作

frecordtype:大型唱片

这将为大型的frecordtype搜索,这将带回什么..然后记录整个默认领域Solr的。

相关问题