lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@intelcompute.com
Subject Re: Solr - Group search result
Date Tue, 22 Dec 2009 11:10:42 GMT
see
http://blog.jteam.nl/2009/10/20/result-grouping-field-collapsing-with-solr/
[1] for a good little howto.
	and also http://wiki.apache.org/solr/FieldCollapsing [2]
On Tue 22/12/09 11:03 , JKnight JKnight  wrote:Dear all,

I have document doc.xml
  3
  Love you love me
  2
  Love story
  3
  How deep is your love?
  4
  I love you
  5
  How deep is your love?
  6
  Love story
and in schema.xml, I add two line
After post doc.xml to solr server and run query
http://localhost:8983/solr/select/%3Fwt%3Djson%26amp%3Bindent%3Don%26amp%3Bq%3Dlove%2520you%26amp%3Bfl%3Dname%26amp%3Bfacet%3Dtrue%26amp%3Bfacet.field%3Dname_exact
[3]"
target="_blank">http://localhost:8983/solr/select/?wt=json&indent=on&q=love%20you&fl=name&facet=true&facet.field=name_exact

I see the response:
{
 "responseHeader":{
  "status":0,
  "QTime":4,
  "params":{
    "facet":"true",
    "fl":"name",
    "indent":"on",
    "q":"love you",
    "facet.field":"name_exact",
    "wt":"json"}},
 "response":{"numFound":5,"start":0,"docs":[
    {
     "name":"I love you"},
    {
     "name":"Love story"},
    {
     "name":"Love story"},
    {
     "name":"How deep is your love?"},
    {
     "name":"How deep is your love?"}]
 },
 "facet_counts":{
  "facet_queries":{},
  "facet_fields":{
    "name_exact":[
     "How deep is your love?",2,
     "Love story",2,
     "I love you",1,
     "Love you love me",0,
     "Quyen day ne",0,
     "day ne",0]},
  "facet_dates":{}}}

And I have a question. How can I group search result? With my data, I
want
to group by "name" field and see only 3 record
    {
     "name":"I love you"},
    {
     "name":"Love story"},
    {
     "name":"How deep is your love?"}

Could you help me?

Thank a lot for support.

-- 
Best regards,
JKnight
-------------------------
Message sent via Atmail Open - http://atmail.org/

Links:
------
[1]
http://blog.jteam.nl/2009/10/20/result-grouping-field-collapsing-with-solr/
[2] http://wiki.apache.org/solr/FieldCollapsing
[3] http://mail.intelcompute.com/parse.php?redirect=<a href=

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message