Question

I cannot understand result of faceted search.

I indexed two files:

1:

<add>
<doc>
  <field name="id">SOLR1000</field>
  <field name="name">Solr, the Enterprise Search Server</field>
  <field name="manu">Apache Software Foundation</field>
  <field name="cat">software</field>
  <field name="cat">search</field>
  <field name="cat">XXX</field>
  <field name="cat">XXX</field>
  <field name="features">Advanced Full-Text Search Capabilities using Lucene</field>
  <field name="features">Optimized for High Volume Web Traffic</field>
  <field name="features">Standards Based Open Interfaces - XML and HTTP</field>
  <field name="features">Comprehensive HTML Administration Interfaces</field>
  <field name="features">Scalability - Efficient Replication to other Solr Search Servers</field>
  <field name="features">Flexible and Adaptable with XML configuration and Schema</field>
  <field name="features">Good unicode support: h&#xE9;llo (hello with an accent over the e)</field>
  <field name="price">0</field>
  <field name="popularity">10</field>
  <field name="inStock">true</field>
  <field name="incubationdate_dt">2006-01-17T00:00:00.000Z</field>
</doc>
</add>

2:

<add><doc>
  <field name="id">3007WFP</field>
  <field name="name">Dell Widescreen UltraSharp 3007WFP</field>
  <field name="manu">Dell, Inc.</field>
  <!-- Join -->
  <field name="manu_id_s">dell</field>
  <field name="cat">electronics</field>
  <field name="cat">monitor</field>
  <field name="features">30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast</field>
  <field name="includes">USB cable</field>
  <field name="weight">401.6</field>
  <field name="price">2199</field>
  <field name="popularity">6</field>
  <field name="inStock">true</field>
  <!-- Buffalo store -->
  <field name="store">43.17614,-90.57341</field>
</doc></add>

my simple facet request:

http://localhost:8983/solr/collection1/select/?indent=on&q=*:*&fl=name&facet=true&facet.field=cat

interesting part of response:

<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="cat">
<int name="XXX">1</int>
<int name="electronics">1</int>
<int name="monitor">1</int>
<int name="search">1</int>
<int name="software">1</int>
</lst>
</lst>
<lst name="facet_dates"/>
<lst name="facet_ranges"/>
</lst>
</response>

I don't understand what does it mean. If you could clearly explain it - I will very helpful.

Notably unclear

 <int name="XXX">1</int>

How Can I change to

<int name="XXX">2</int>
Was it helpful?

Solution

Only one of your indexed items match cat=XXX. The fact that you have added it twice on one of them doesn't make a difference.

In your request to Solr you chose to facet on the field cat, so the response will include a lst element faceting on the cat field.

Every int element within that list contains acount of how many items match the different categories. So all the categories XXX, electronics, monitor, search and software match one item each.

If you would for example add <field name="cat">XXX</field> to the second item, you would get <int name="XXX">2</int> in the response.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top