Solr Results Grouping using RiakSearchRequest

Dennis Nicolay dnicolay at orcawave.net
Wed Nov 25 11:49:19 EST 2015


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
<http://10.3.3.190:8091/solr/cdkcdrbucketindex/select?wt=json&indent=true&fl
=DateOnly_s&q=TransmissionStateName_s:DELIVERED&group=true&group.field=DateO
nly_s&rows=10000000>
&indent=true&fl=DateOnly_s&q=TransmissionStateName_s:DELIVERED&group=true&gr
oup.field=DateOnly_s&rows=10000000

Thanks,

Dennis

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20151125/86e336cb/attachment-0002.html>


More information about the riak-users mailing list