Riak Search Schema Question

Alexander Sicular siculars at gmail.com
Sun Oct 26 10:58:25 EDT 2014


That might happen.

Could you rearrange your data to look like 

Id: ... , stats: {
  Stat1: [ ... ],
  Stat2: [ ... ],
  ...

}

Then you could do a stats_stat1 > 1 query. It's also more space efficient. Derived vs explicit naming. Stat(N) could even be an array of hashes like [{value:..., dates:...},...] if you needed that. 

-Alexander 

@siculars
http://siculars.posthaven.com

Sent from my iRotaryPhone

> On Oct 26, 2014, at 10:43, Andrew Zeneski <andrew at andrewzeneski.com> wrote:
> 
> Yes right, I was tired when I typed this; stats should be an array:
> 
> {"id": 1, "stats": [{ "name": "stat1", "value": 1 }, {"name": "stat2", "value": 5}]}
> {"id": 2, "stats": [{ "name": "stat3", "value": 2 }, {"name": "stat1", "value": 3}]}
> {"id": 3, "stats": [{ "name": "stat2", "value": 3 }, {"name": "stat3", "value": 1}}]
> 
> I haven't tried it either, but I was worried that stats_name = stat1 and stats_value > 1 would return both ID 1 and 2 because both have a name stats1 and both have some value > 1.
> 
> Andrew
> 
> 
>> On Sun, Oct 26, 2014 at 12:50 AM, Alexander Sicular <siculars at gmail.com> wrote:
>> Haven't tried it out but should stats be an array?
>> 
>> And the query would be something like
>> 
>> Stats_name = stat1 and stats_value > 1
>> 
>> I think the extractor flattens everything and separates with underscores.
>> 
>> -Alexander
>> 
>> @siculars
>> http://siculars.posthaven.com
>> 
>> Sent from my iRotaryPhone
>> 
>> > On Oct 25, 2014, at 22:53, Andrew Zeneski <andrew at andrewzeneski.com> wrote:
>> >
>> > Hi All, I'm trying to determine if  a use case is supported by Yokozuna or not.
>> >
>> > With a stored value that looks like:
>> >
>> > {"id": 1, "stats": { "name": "stat1", "value": 1 }, {"name": "stat2", "value": 5}}
>> > {"id": 2, "stats": { "name": "stat3", "value": 2 }, {"name": "stat1", "value": 3}}
>> > {"id": 3, "stats": { "name": "stat2", "value": 3 }, {"name": "stat3", "value": 1}}
>> >
>> > I want to find those who have stat1 > 2. The result should be id 2.
>> >
>> > I believe Solr 4.8 would handle this as a block-join, but I don't think Yokozuna supports this feature. My first thought was a custom extractor; are there other options I'm not seeing?
>> >
>> > Thanks!
>> >
>> > Andrew
>> > _______________________________________________
>> > riak-users mailing list
>> > riak-users at lists.basho.com
>> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20141026/450a83d9/attachment.html>


More information about the riak-users mailing list