简体   繁体   中英

what does facet in Solr means?

Can you please explain me , what is facet ? What did I understand is , suppose I have following documents.

State  Country
karntaka India
Bangalore India
Delhi     India
Noida     India

It collapse multiple same value of field to a single value and returns number of times that value occurred. Now when i am search on field 'Country' then obviously I am getting 4 times India , So i keep facet=on and facet.field=Country, with a motive of getting only one time India , but when i fired query rather I am getting
some weird result

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">6</int>
</lst>
<result name="response" numFound="4" start="0">
  <doc>
    <str name="country">India</str></doc>
  <doc>
    <str name="country">India</str></doc>
  <doc>
    <str name="country">India</str></doc>
  <doc>
    <str name="country">India</str></doc>
</result>
<lst name="facet_counts">
  <lst name="facet_queries"/>
  <lst name="facet_fields">
    <lst name="country">
      <int name="a">4</int>
      <int name="d">4</int>
      <int name="di">4</int>
      <int name="dia">4</int>
      <int name="i">4</int>
      <int name="ia">4</int>
      <int name="in">4</int>
      <int name="ind">4</int>
      <int name="indi">4</int>
      <int name="india">4</int>
    </lst>
  </lst>
  <lst name="facet_dates"/>
  <lst name="facet_ranges"/>
</lst>
</response>

Can any one help me to understand . Thanks

If you had a Washington, USA entry, the facet would report 4 results for India and 1 for USA .

Use a string field type. You seem to have used a (text) field with lowercasing and n-gramming, which may benefit people who spell India as Inde, for example. A string field is not processed like this and therefore its best suited for a field meant to be faceted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM