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 Romi <ro...@gmail.com> on 2011/06/30 11:50:35 UTC

How to use solr clustering to show in search results

wanted to use clustering in my search results, i configured solr for
clustering and i got following json for clusters. But i am not getting how
to use it to show in search results. as corresponding to one doc i have
number of fields and up till now i am showing name, description and id. now
in clusters i have labels and doc id. then how to use my docs in clusters, i
am really confused what to do Please reply. 

*
"clusters":[

            {
                   "labels":[
                       "Complement any Business Casual or Semi-formal
Attire"
                    ],
                   "docs":[
                        "7799",
                        "7801"
                    ]
              },
            {
                   "labels":[
                        "Design"
                    ],
                   "docs":[
                        "8252",
                        "7885"
                    ]
              },
            {
                   "labels":[
                        "Elegant Ring has an Akoya Cultured Pearl"
                    ],
                   "docs":[
                        "8142",
                        "8139"
                    ]
              },
            {
                   "labels":[
                        "Feel Amazing in these Scintillating Earrings
Perfect"
                    ],
                   "docs":[
                        "12250",
                        "12254"
                    ]
              },
            {
                   "labels":[
                        "Formal Evening Attire"
                    ],
                   "docs":[
                        "8151",
                        "8004"
                    ]
              },
            {
                   "labels":[
                        "Pave Set"
                    ],
                   "docs":[
                        "7788",
                        "8169"
                    ]
              },
            {
                   "labels":[
                        "Subtle Look or Layer it or Attach"
                    ],
                   "docs":[
                        "8014",
                        "8012"
                    ]
              },
           {
                   "labels":[
                        "Three-stone Setting is Elegant and Fun"
                    ],
                   "docs":[
                        "8335",
                        "8337"
                    ]
              },
            {
                   "labels":[
                        "Other Topics"
                    ],
                   "docs":[
                        "8038",
                        "7850",
                        "7795",
                        "7989",
                        "7797"
                    ]
          {
    ]*


-----
Thanks & Regards
Romi
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-use-solr-clustering-to-show-in-search-results-tp3125149p3125149.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to use solr clustering to show in search results

Posted by Stanislaw Osinski <st...@carrotsearch.com>.
The "docs" array contained in each cluster contains ids of documents
belonging to the cluster, so for each id you need to look up the document's
content, which comes earlier in the response (in the response/docs array).

Cheers,

Staszek

On Thu, Jun 30, 2011 at 11:50, Romi <ro...@gmail.com> wrote:

> wanted to use clustering in my search results, i configured solr for
> clustering and i got following json for clusters. But i am not getting how
> to use it to show in search results. as corresponding to one doc i have
> number of fields and up till now i am showing name, description and id. now
> in clusters i have labels and doc id. then how to use my docs in clusters,
> i
> am really confused what to do Please reply.
>
> *
> "clusters":[
>
>            {
>                   "labels":[
>                       "Complement any Business Casual or Semi-formal
> Attire"
>                    ],
>                   "docs":[
>                        "7799",
>                        "7801"
>                    ]
>              },
>            {
>                   "labels":[
>                        "Design"
>                    ],
>                   "docs":[
>                        "8252",
>                        "7885"
>                    ]
>              },
>            {
>                   "labels":[
>                        "Elegant Ring has an Akoya Cultured Pearl"
>                    ],
>                   "docs":[
>                        "8142",
>                        "8139"
>                    ]
>              },
>            {
>                   "labels":[
>                        "Feel Amazing in these Scintillating Earrings
> Perfect"
>                    ],
>                   "docs":[
>                        "12250",
>                        "12254"
>                    ]
>              },
>            {
>                   "labels":[
>                        "Formal Evening Attire"
>                    ],
>                   "docs":[
>                        "8151",
>                        "8004"
>                    ]
>              },
>            {
>                   "labels":[
>                        "Pave Set"
>                    ],
>                   "docs":[
>                        "7788",
>                        "8169"
>                    ]
>              },
>            {
>                   "labels":[
>                        "Subtle Look or Layer it or Attach"
>                    ],
>                   "docs":[
>                        "8014",
>                        "8012"
>                    ]
>              },
>           {
>                   "labels":[
>                        "Three-stone Setting is Elegant and Fun"
>                    ],
>                   "docs":[
>                        "8335",
>                        "8337"
>                    ]
>              },
>            {
>                   "labels":[
>                        "Other Topics"
>                    ],
>                   "docs":[
>                        "8038",
>                        "7850",
>                        "7795",
>                        "7989",
>                        "7797"
>                    ]
>          {
>    ]*
>
>
> -----
> Thanks & Regards
> Romi
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-use-solr-clustering-to-show-in-search-results-tp3125149p3125149.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>