在solr上分组

I'm trying with no success to make simple grouping on solr with 2 field data base id and name try to grouping on field "name". I expect to get one row with the name "yosi" but I get 4 rows What should I change in params below

   object(Apache_Solr_Response)#3 (5) {
    ["_response":protected]=>
     object(Apache_Solr_HttpTransport_Response)#4 (5) {
         ["_statusCode":"Apache_Solr_HttpTransport_Response":private]=>
      int(200)
        ["_statusMessage":"Apache_Solr_HttpTransport_Response":private]=>
             string(2) "OK"
         ["_mimeType":"Apache_Solr_HttpTransport_Response":private]=>
            string(10) "text/plain"
               ["_encoding":"Apache_Solr_HttpTransport_Response":private]=>
            string(5) "utf-8"
               ["_responseBody":"Apache_Solr_HttpTransport_Response":private]=>
               string(767) "{
          "responseHeader":{
                  "status":0,
               "QTime":2,
               "params":{
                    "indent":"true",
           "group.query":"yosi",
                "json.nl":"map",
        "hl.fl":"name",
            "wt":"json",
            "hl":"true",
                "version":"2.2",
                "rows":"100",
            "fl":"*,score",
        "start":"0",
        "q":"yosi",
        "group.field":"name",
        "group":"true",
        "qt":"standard"}},
                 "response":{"numFound":4,"start":0,"maxScore":1.8754687,"docs":[

Please let me know why it doesn't do the work Thanks Yosi

It's been a while but might still come useful to someone.

First, Solr grouping (field collapsing) is only available since Solr 3.3. Make sure you're using this or more recent version because for earlier ones there is basically no solution (well, there are patches adding this functionality but you'll still have to rebuild your package which is hardly less dangerous than upgrading your version).

Detailed documentation on grouped requests is available at http://wiki.apache.org/solr/FieldCollapsing

It states that the field you're using for grouping "must be single-valued and must be either indexed, or be another field type that has a value source and works in a function query". In Solr 3.3 it can be also an indexed text or string field. Check your schema XML to see if that's right for you.

Another thought is that the field name name might be reserved, so if advice above doesn't help, try some other indexed text field (this is a guess as up to my knowledge there are reserved characters in Solr but not reserved field names).

P.S. You might also want to change your "group.query":"yosi" to "group.query":"name: yosi" (not related to that particular problem but apparently that'd be better in your situation).