This is correct, search will convert nested objects to underscores in the
field name.

-Ryan

On Tue, Sep 13, 2011 at 12:53 PM, Eric Moritz <[email protected]>wrote:

> I maybe wrong but I believe nested values use underscores. So the field
> would be address_state:NY
> On Sep 13, 2011 12:10 PM, "Denis Papathanasiou" <
> [email protected]> wrote:
> > I'm using the latest version of riak (0.14.2-1) with the
> > riak-python-client (v. 1.3.0).
> >
> > I want to run the Riak Search example shown in the documentation
> > (https://bitbucket.org/basho/riak-python-client), but the json docs
> > I've added to my bucket are more complex than the example.
> >
> > I.e., instead of this:
> >
> > {'first_name': 'Anna', 'last_name': 'Body', 'is_active': True}
> >
> > my docs look like this:
> >
> > { firstName: "Mike", lastName: "Bloomberg", address: { city: "New
> > York", state: "NY" }, teams: [ 'Giants', 'Jets', 'Yankees', 'Mets' ] }
> >
> > So how do I search for state = NY ?
> >
> > I tried this:
> >
> > search_query = client.search('formd', 'address.state:NY')
> >
> > for result in search_query.run():
> > # You get ``RiakLink`` objects back.
> > person = result.get()
> > person_data = person.get_data()
> > print "%s %s" % (person_data['firstName'], user_data['lastName'])
> >
> > but I got this stack trace:
> >
> > Traceback (most recent call last):
> > File "query_test.py", line 9, in <module>
> > for result in search_query.run():
> > File "build/bdist.linux-x86_64/egg/riak/mapreduce.py", line 211, in run
> > File "build/bdist.linux-x86_64/egg/riak/transports/pbc.py", line
> > 311, in mapred
> > File "build/bdist.linux-x86_64/egg/riak/transports/pbc.py", line
> > 365, in recv_msg
> > File "build/bdist.linux-x86_64/egg/riak/transports/pbc.py", line
> > 410, in recv_pkt
> > riak.RiakError: 'Socket returned short packet length - expected 4'
> >
> > _______________________________________________
> > riak-users mailing list
> > [email protected]
> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to