Cómo hacer una consulta de grupo de facetas en Apache solr

I am doing a facet query on solr.. Which gives me facets and its count for each item... But now I want to perform a group query on facets.. Which gives me count according to group...

Ejemplo

Below is the data

Item1: Nike shoes (size:8,9,10) Item2 : Reebok Shoes(size:8,9,10)

Now in this case my brand facet query returns me result as below

  • Nike:3

  • Reebok:3

The result I required is

  • Nike:1
  • Reebok:1

saludos

preguntado el 31 de julio de 12 a las 12:07

2 Respuestas

have you enabled group.facet=true as explained aquí. You need at least 3.3

Respondido 31 Jul 12, 14:07

group.facet is not available in solrNet 0.4. Know any better workaround than modifying the source of SolrNet? - Ali Kareem Raja

http://1XX.XXX.XXX.XXX:8080/solr/autocomplete/select?q=displayterm:new&wt=json&indent=true&q.op=and&fl=displayterm&group=true&group.field=displayterm

Nota: &group=true&group.field=displayterm
This response become group by displayterm

Respuesta :

{
  "responseHeader":{
    "status":0,
    "QTime":6,
    "params":{
      "fl":"displayterm",
      "indent":"true",
      "q":"displayterm:new",
      "q.op":"and",
      "group.field":"displayterm",
      "group":"true",
      "wt":"json"}},
  "grouped":{
    "displayterm":{
      "matches":231,
      "groups":[{
          "groupValue":null,
          "doclist":{"numFound":220,"start":0,"docs":[
              {
                "displayterm":"Professional News"}]
          }},
        {
          "groupValue":"general",
          "doclist":{"numFound":1,"start":0,"docs":[
              {
                "displayterm":"General News"}]
          }},
        {
          "groupValue":"delhi",
          "doclist":{"numFound":2,"start":0,"docs":[
              {
                "displayterm":"New Delhi"}]
          }},
        {
          "groupValue":"care",
          "doclist":{"numFound":1,"start":0,"docs":[
              {
                "displayterm":"New Born Care Week"}]
          }},
        {
          "groupValue":"civil",
          "doclist":{"numFound":1,"start":0,"docs":[
              {
                "displayterm":"NEW CIVIL HOSPITAL, SURAT"}]
          }},
        {
          "groupValue":"blood",
          "doclist":{"numFound":1,"start":0,"docs":[
              {
                "displayterm":"Newlife Blood Bank"}]
          }},
        {
          "groupValue":"college",
          "doclist":{"numFound":1,"start":0,"docs":[
              {
                "displayterm":"New Medical College Hospital"}]
          }},
        {
          "groupValue":"degree",
          "doclist":{"numFound":1,"start":0,"docs":[
              {
                "displayterm":"Homeopathy(Degree Course) Regulation New"}]
          }},
        {
          "groupValue":"child",
          "doclist":{"numFound":1,"start":0,"docs":[
              {
                "displayterm":"Reproductive, Maternal, Newborn, Child and Adolescent Health"}]
          }},
        {
          "groupValue":"foundation",
          "doclist":{"numFound":1,"start":0,"docs":[
              {
                "displayterm":"The new century Medical and Educational foundation malegaon, Nashik"}]
          }}]}}}

Respondido el 13 de diciembre de 16 a las 06:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.