You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Steve Barr <st...@pobox.com> on 2007/12/07 17:34:39 UTC

Facet question

I'm new to Solr and getting an unexpected result.  Basically I have a
field "location" and one document with location values "Europe",
"France", and "United States".  When I try to do a faceted query on
the location field, "France" returns 0 results, but the other two
locations are found.

Schema.xml:
...
   <field name="location" type="string" indexed="true" stored="true"
required="false" multiValued="true" />
...

Add document:
...
<field name="location">Europe</field>
<field name="location">United States</field>
<field name="location">France</field>
...

Querying for "France" shows no results:

http://localhost:8080/solr/select?q=France&rows=0&facet=true&facet.limit=-1&facet.field=location

<response>
	<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">10</int>
	<lst name="params">
<str name="facet">true</str>
<str name="q">France</str>
<str name="facet.limit">-1</str>
<str name="facet.field">location</str>
<str name="rows">0</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
	<lst name="facet_counts">
<lst name="facet_queries"/>
	<lst name="facet_fields">
	<lst name="location">
<int name="Europe">0</int>
<int name="France">0</int>
<int name="United States">0</int>
</lst>
</lst>
</lst>
</response>

But querying for "Europe" or "United States" (United%20States) does
find a match, for ex:

http://localhost:8080/solr/select?q=Europe&rows=0&facet=true&facet.limit=-1&facet.field=location

<response>
	<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
	<lst name="params">
<str name="facet">true</str>
<str name="q">Europe</str>
<str name="facet.limit">-1</str>
<str name="facet.field">location</str>
<str name="rows">0</str>
</lst>
</lst>
<result name="response" numFound="1" start="0"/>
	<lst name="facet_counts">
<lst name="facet_queries"/>
	<lst name="facet_fields">
	<lst name="location">
<int name="Europe">1</int>
<int name="France">1</int>
<int name="United States">1</int>
</lst>
</lst>
</lst>
</response>

Thanks for any help!

Steve

Re: Facet question

Posted by Yonik Seeley <yo...@apache.org>.
On Dec 7, 2007 11:34 AM, Steve Barr <st...@pobox.com> wrote:
> I'm new to Solr and getting an unexpected result.  Basically I have a
> field "location" and one document with location values "Europe",
> "France", and "United States".  When I try to do a faceted query on
> the location field, "France" returns 0 results, but the other two
> locations are found.
[...]
> http://localhost:8080/solr/select?q=France&rows=0&facet=true&facet.limit=-1&facet.field=location

This is querying for "France" in the default search field (defined in
the schema).
If you want to show documents with only France in the location field,
change q to location:France
If you want the facets for all documents, try changing q to *:*

-Yonik