Solr Results Grouping using RiakSearchRequest

Luke Bakken lbakken at basho.com
Mon Nov 30 16:02:20 EST 2015


Hi Dennis,

There is a grouping example here:
https://github.com/basho/riak-dotnet-client/wiki/Search

There is some support for sending the Solr query to Riak here:
https://github.com/basho/riak-dotnet-client/blob/develop/src/RiakClient/Models/Search/RiakSearchRequest.cs#L88

But I suspect the above doesn't support grouping. If that is a useful
feature, please open an Issue and request it. PRs implementing
features are even better :-)

--
Luke Bakken
Engineer
lbakken at basho.com


On Wed, Nov 25, 2015 at 8:49 AM, Dennis Nicolay <dnicolay at orcawave.net> wrote:
> Hi,
>
>
>
> Just to clarify what I’m trying to accomplish.  I’m trying to translate the
> http solr query into using RiakSearchRequest/RiakFluentSearch.
>
>
>
> I’ve gotten this far but I cannot figure out how to do grouping in solr
> using .net:
>
>
>
> using (var cluster = RiakCluster.FromConfig("riakConfig"))
>
>             {
>
>                 List<string> fields = new List<string>();
>
>                 List<string> dates = new List<string>();
>
>                 fields.Add("DateOnly_s");
>
>                 IRiakClient client = cluster.CreateClient();
>
>                 var search = new RiakSearchRequest
>
>                 {
>
>                     Start = 0,
>
>                     Rows = 50000,
>
>                     ReturnFields = fields,
>
>                     Query = new RiakFluentSearch("cdkcdrbucketindex",
> "TransmissionStateName_s")
>
>                           .Search("DELIVERED")
>
>                          .Build()
>
>                 };
>
>                 var rslt = client.Search(search);
>
>
>
>                 RiakSearchResult sr = rslt.Value;
>
>
>
>                 foreach (RiakSearchResultDocument doc in sr.Documents)
>
>                 {
>
>                     dates.Add(doc.Fields[0].Value.ToString());
>
>                 }
>
>                 var grouped = dates
>
>                          .GroupBy(s => s)
>
>                          .Select(group => new { Date = group.Key, Count =
> group.Count() });
>
>                foreach( var t in grouped)
>
>                {
>
>                    t.Date.ToString();
>
>                    t.Count.ToString();
>
>                }
>
>                grouped.Count();
>
>             }
>
>
>
> Does it make sense to aggregate the data into a bucket which models the
> desired result set instead of trying to do the aggregation using
> RiakSearchRequest/RiakFluentSearch?
>
>
>
> Thanks,
>
> Dennis
>
>
>
> From: Dennis Nicolay [mailto:dnicolay at orcawave.net]
> Sent: Tuesday, November 24, 2015 8:05 AM
> To: riak-users at lists.basho.com
> Subject: Solr Results Grouping using RiakSearchRequest
>
>
>
> Hi,
>
>
>
> Is there a way to use RiakSearchRequest to accomplish the following http
> solr query?
>
>
>
> http://10.3.3.190:8091/solr/cdkcdrbucketindex/select?wt=json&indent=true&fl=DateOnly_s&q=TransmissionStateName_s:DELIVERED&group=true&group.field=DateOnly_s&rows=10000000
>
> Thanks,
>
> Dennis
>
>
>
>
>
>
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>




More information about the riak-users mailing list