Re: Riak Search Issue

2014-08-19 Thread Alex De la rosa
Hi Eric,

You were right on naming the bucket the same as the index... it worked that
way:

bucket = client.bucket_type('futbolistas').bucket('famoso')
results = bucket.search('name_s:Lion*')
print results

{'num_found': 2, 'max_score': 1.0, 'docs': [{u'age_i': u'30', u'name_s':
u'Lionel', u'_yz_rk': u'lionel', u'_yz_rb': u'fcb', u'score':
u'1.e+00', u'leader_b': u'true', u'_yz_id':
u'1*futbolistas*fcb*lionel*59', u'_yz_rt': u'futbolistas'}, {u'age_i':
u'30', u'name_s': u'Lionel', u'_yz_rk': u'lionel', u'_yz_rb': u'famoso',
u'score': u'1.e+00', u'leader_b': u'true', u'_yz_id':
u'1*futbolistas*famoso*lionel*8', u'_yz_rt': u'futbolistas'}]}

Later will check to install GIT's version and see if it works with a
different bucket name.

Thanks.
Alex


On Mon, Aug 18, 2014 at 11:12 PM, Alex De la rosa alex.rosa@gmail.com
wrote:

 Hi Eric,

 I will try this suggestion, also I will try Luke's suggestion on using
 GIT's latest version instead of PIP to see if is something already fixed.

 Once done that, I will tell you guys if is really a bug or if it was fixed
 already on GIT cloning.

 Thanks,
 Alex


 On Mon, Aug 18, 2014 at 11:10 PM, Eric Redmond eredm...@basho.com wrote:

 Alex,

 You may have discovered a legitimate bug in the python driver. In the
 meantime, if you give your bucket and index the same name, you can proceed,
 while we investigate.

 Thanks,
 Eric


 On Aug 18, 2014, at 2:00 PM, Alex De la rosa alex.rosa@gmail.com
 wrote:

 Yes, I did it in purpose, because I did so many testings that I wanted to
 start fresh... so I kinda translated the documentation, but that is
 irrelevant to the case.

 Thanks,
 Alex


 On Mon, Aug 18, 2014 at 10:59 PM, Eric Redmond eredm...@basho.com
 wrote:

 Your steps seemed to have named the index famoso.

 Eric


 On Aug 18, 2014, at 1:56 PM, Alex De la rosa alex.rosa@gmail.com
 wrote:

 Ok, I found the first error in the documentation, parameters are in
 reverse order:

 bucket = client.bucket('animals', 'cats')

 should be:

 bucket = client.bucket('cats', 'animals')

 Now I could save and it found the bucket type: bucket =
 client.bucket('fcb','futbolistas') VS bucket = client.bucket('futbolistas',
 'fcb')

 However, even fixing that, the next step fails as it was failing before:

              
          
 PYTHON:
   bucket = client.bucket('fcb','futbolistas')
   results = bucket.search('name_s:Lion*')
   print results
              
          
 Traceback (most recent call last):
   File x.py, line 13, in module
 results = bucket.search('name_s:Lion*')
   File /usr/local/lib/python2.7/dist-packages/riak/bucket.py, line
 420, in search
 return self._client.fulltext_search(self.name, query, **params)
   File
 /usr/local/lib/python2.7/dist-packages/riak/client/transport.py, line
 184, in wrapper
 return self._with_retries(pool, thunk)
   File
 /usr/local/lib/python2.7/dist-packages/riak/client/transport.py, line
 126, in _with_retries
 return fn(transport)
   File
 /usr/local/lib/python2.7/dist-packages/riak/client/transport.py, line
 182, in thunk
 return fn(self, transport, *args, **kwargs)
   File
 /usr/local/lib/python2.7/dist-packages/riak/client/operations.py, line
 573, in fulltext_search
 return transport.search(index, query, **params)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/transport.py,
 line 564, in search
 MSG_CODE_SEARCH_QUERY_RESP)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
 line 50, in _request
 return self._recv_msg(expect)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
 line 142, in _recv_msg
 raise RiakError(err.errmsg)
 riak.RiakError: 'No index fcb found.'

 Again it says fcb index not found... and this time I fully followed
 the right documentation and didn't use bucket.enable_search()

 Thanks,
 Alex


 On Mon, Aug 18, 2014 at 10:49 PM, Alex De la rosa 
 alex.rosa@gmail.com wrote:

 Hi Eric,

 I'm sorry but I followed the documentation that you provided me and
 still raises issues:

              
          
 STEP 1: Create Index: famoso
              
          
 PYTHON:
   client.create_search_index('famoso')

              
          
 STEP 2: Create Bucket Type: futbolistas
              
          
 SHELL:
   riak-admin bucket-type create futbolistas
 '{props:{search_index:famoso}}'

Re: Riak Search Issue

2014-08-19 Thread Alex De la rosa
Hi Sean,

Yeah, I opted to follow that pattern on my latest attempt as I see it more
clear that the way in the documentation. Still same issue although with
Eric we saw it works fine when index and bucket has the same name.

Thanks!
Alex


On Mon, Aug 18, 2014 at 11:27 PM, Sean Cribbs s...@basho.com wrote:

 Don't use bucket with 2 arguments, use
 client.bucket_type('futbolistas').bucket('fcb'). This makes your
 intent more clear. The 2-arity version of bucket() was for
 backwards-compatibility.

 On Mon, Aug 18, 2014 at 4:10 PM, Eric Redmond eredm...@basho.com wrote:
  Alex,
 
  You may have discovered a legitimate bug in the python driver. In the
  meantime, if you give your bucket and index the same name, you can
 proceed,
  while we investigate.
 
  Thanks,
  Eric
 
 
  On Aug 18, 2014, at 2:00 PM, Alex De la rosa alex.rosa@gmail.com
  wrote:
 
  Yes, I did it in purpose, because I did so many testings that I wanted to
  start fresh... so I kinda translated the documentation, but that is
  irrelevant to the case.
 
  Thanks,
  Alex
 
 
  On Mon, Aug 18, 2014 at 10:59 PM, Eric Redmond eredm...@basho.com
 wrote:
 
  Your steps seemed to have named the index famoso.
 
  Eric
 
 
  On Aug 18, 2014, at 1:56 PM, Alex De la rosa alex.rosa@gmail.com
  wrote:
 
  Ok, I found the first error in the documentation, parameters are in
  reverse order:
 
  bucket = client.bucket('animals', 'cats')
 
  should be:
 
  bucket = client.bucket('cats', 'animals')
 
  Now I could save and it found the bucket type: bucket =
  client.bucket('fcb','futbolistas') VS bucket =
 client.bucket('futbolistas',
  'fcb')
 
  However, even fixing that, the next step fails as it was failing before:
 
               
 
          
  PYTHON:
bucket = client.bucket('fcb','futbolistas')
results = bucket.search('name_s:Lion*')
print results
               
 
          
  Traceback (most recent call last):
File x.py, line 13, in module
  results = bucket.search('name_s:Lion*')
File /usr/local/lib/python2.7/dist-packages/riak/bucket.py, line
 420,
  in search
  return self._client.fulltext_search(self.name, query, **params)
File
 /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
  line 184, in wrapper
  return self._with_retries(pool, thunk)
File
 /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
  line 126, in _with_retries
  return fn(transport)
File
 /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
  line 182, in thunk
  return fn(self, transport, *args, **kwargs)
File
 /usr/local/lib/python2.7/dist-packages/riak/client/operations.py,
  line 573, in fulltext_search
  return transport.search(index, query, **params)
File
 
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/transport.py,
  line 564, in search
  MSG_CODE_SEARCH_QUERY_RESP)
File
 
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
  line 50, in _request
  return self._recv_msg(expect)
File
 
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
  line 142, in _recv_msg
  raise RiakError(err.errmsg)
  riak.RiakError: 'No index fcb found.'
 
  Again it says fcb index not found... and this time I fully followed
 the
  right documentation and didn't use bucket.enable_search()
 
  Thanks,
  Alex
 
 
  On Mon, Aug 18, 2014 at 10:49 PM, Alex De la rosa
  alex.rosa@gmail.com wrote:
 
  Hi Eric,
 
  I'm sorry but I followed the documentation that you provided me and
 still
  raises issues:
 
               
           
  STEP 1: Create Index: famoso
               
           
  PYTHON:
client.create_search_index('famoso')
 
               
           
  STEP 2: Create Bucket Type: futbolistas
               
           
  SHELL:
riak-admin bucket-type create futbolistas
  '{props:{search_index:famoso}}'
= futbolistas created
riak-admin bucket-type activate futbolistas
= futbolistas has been activated
 
               
           
  STEP 3: Create Bucket and Add data: fcb
               
           
  PYTHON:
bucket = client.bucket('futbolistas', 'fcb')
c = bucket.new('lionel', {'name_s': 'Lionel', 'age_i': 30,
 

Re: Riak Search Issue

2014-08-18 Thread Luke Bakken
What is the output of this command? Please replace RIAK_HOST and
name_of_the_bucket with the correct information:

curl $RIAK_HOST/search/index/name_of_the_bucket

If the above returns a 404, please use this guide to ensure you've
created the index correctly:

http://docs.basho.com/riak/2.0.0/dev/using/search/

If you expect the index to be there and it is not, the solr.log file
in /var/log/riak could provide a clue.

--
Luke Bakken
CSE
lbak...@basho.com


On Mon, Aug 18, 2014 at 6:59 AM, Alex De la rosa
alex.rosa@gmail.com wrote:
 Hi there,

 I had been following the documentation [
 http://docs.basho.com/riak/2.0.0/dev/using/search/ ] about Riak Search and
 the code provided in the site doesn't seem to work?

 Everything I try ends up with an error saying no index found taking the name
 of the bucket as a not found index :(

 riak.RiakError: 'No index name_of_the_bucket found.'

 Somebody knows what's going on?

 Thanks!
 Alex


 ___
 riak-users mailing list
 riak-users@lists.basho.com
 http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Riak Search Issue

2014-08-18 Thread Alex De la rosa
If I do this, I got the right index:

http://RIAK:8098/search/index/famous
= {name:famous,n_val:3,schema:_yz_default}

If I do this, I get an error:
http://RIAK:8098/search/index/animals
= not found

What I don't understand is why it believes the index is the bucket name and
not the index I created for it?

riak-admin bucket-type create animals '{props:{search_index:famous}}'
riak-admin bucket-type activate animals

Shouldn't it be looking for a famous index instead of an animals index??

Thanks!
Alex


On Mon, Aug 18, 2014 at 4:26 PM, Luke Bakken lbak...@basho.com wrote:

 What is the output of this command? Please replace RIAK_HOST and
 name_of_the_bucket with the correct information:

 curl $RIAK_HOST/search/index/name_of_the_bucket

 If the above returns a 404, please use this guide to ensure you've
 created the index correctly:

 http://docs.basho.com/riak/2.0.0/dev/using/search/

 If you expect the index to be there and it is not, the solr.log file
 in /var/log/riak could provide a clue.

 --
 Luke Bakken
 CSE
 lbak...@basho.com


 On Mon, Aug 18, 2014 at 6:59 AM, Alex De la rosa
 alex.rosa@gmail.com wrote:
  Hi there,
 
  I had been following the documentation [
  http://docs.basho.com/riak/2.0.0/dev/using/search/ ] about Riak Search
 and
  the code provided in the site doesn't seem to work?
 
  Everything I try ends up with an error saying no index found taking the
 name
  of the bucket as a not found index :(
 
  riak.RiakError: 'No index name_of_the_bucket found.'
 
  Somebody knows what's going on?
 
  Thanks!
  Alex
 
 
  ___
  riak-users mailing list
  riak-users@lists.basho.com
  http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
 

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Riak Search Issue

2014-08-18 Thread Luke Bakken
Hi Alex -

You correctly created the famous index, as well as correctly
associated it with the bucket *type* animals. Note that a bucket
type is not the same thing as a bucket in previous versions of Riak. A
bucket type is a way to give 1 or more buckets within that type the
same properties. You'll have to use different code in your Riak client
to use bucket types:

http://docs.basho.com/riak/2.0.0/dev/advanced/bucket-types/

--
Luke Bakken
CSE
lbak...@basho.com


On Mon, Aug 18, 2014 at 7:32 AM, Alex De la rosa
alex.rosa@gmail.com wrote:
 If I do this, I got the right index:

 http://RIAK:8098/search/index/famous
 = {name:famous,n_val:3,schema:_yz_default}

 If I do this, I get an error:
 http://RIAK:8098/search/index/animals
 = not found

 What I don't understand is why it believes the index is the bucket name and
 not the index I created for it?

 riak-admin bucket-type create animals '{props:{search_index:famous}}'
 riak-admin bucket-type activate animals

 Shouldn't it be looking for a famous index instead of an animals index??

 Thanks!
 Alex


 On Mon, Aug 18, 2014 at 4:26 PM, Luke Bakken lbak...@basho.com wrote:

 What is the output of this command? Please replace RIAK_HOST and
 name_of_the_bucket with the correct information:

 curl $RIAK_HOST/search/index/name_of_the_bucket

 If the above returns a 404, please use this guide to ensure you've
 created the index correctly:

 http://docs.basho.com/riak/2.0.0/dev/using/search/

 If you expect the index to be there and it is not, the solr.log file
 in /var/log/riak could provide a clue.

 --
 Luke Bakken
 CSE
 lbak...@basho.com


 On Mon, Aug 18, 2014 at 6:59 AM, Alex De la rosa
 alex.rosa@gmail.com wrote:
  Hi there,
 
  I had been following the documentation [
  http://docs.basho.com/riak/2.0.0/dev/using/search/ ] about Riak Search
  and
  the code provided in the site doesn't seem to work?
 
  Everything I try ends up with an error saying no index found taking the
  name
  of the bucket as a not found index :(
 
  riak.RiakError: 'No index name_of_the_bucket found.'
 
  Somebody knows what's going on?
 
  Thanks!
  Alex

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Riak Search Issue

2014-08-18 Thread Alex De la rosa
Hi Luke,

I also tried with a normal bucket cats using the type animals as the
documentation seemed to suggest and gave me the same error but this time
saying that cats was not found as an index... so... still no clue how to
do it.

This is an alternate code I did looking at the Python client API
documentation, etc...

client.create_search_index('men')
bucket = client.bucket('accounts')
bucket.enable_search()
bucket.set_property('search_index', 'men')
key = bucket.new('alex', data={username:Alex,age:25,sex:male},
content_type='application/json')
key.store()
print bucket.search('sex=male')

Again, it says accounts is not an index... in this code no bucket types
are used, just a plain bucket accounts... what is wrong? what is missing
for it to work??

This is really frustrating.

Thanks,
Alex


On Mon, Aug 18, 2014 at 4:44 PM, Luke Bakken lbak...@basho.com wrote:

 Hi Alex -

 You correctly created the famous index, as well as correctly
 associated it with the bucket *type* animals. Note that a bucket
 type is not the same thing as a bucket in previous versions of Riak. A
 bucket type is a way to give 1 or more buckets within that type the
 same properties. You'll have to use different code in your Riak client
 to use bucket types:

 http://docs.basho.com/riak/2.0.0/dev/advanced/bucket-types/

 --
 Luke Bakken
 CSE
 lbak...@basho.com


 On Mon, Aug 18, 2014 at 7:32 AM, Alex De la rosa
 alex.rosa@gmail.com wrote:
  If I do this, I got the right index:
 
  http://RIAK:8098/search/index/famous
  = {name:famous,n_val:3,schema:_yz_default}
 
  If I do this, I get an error:
  http://RIAK:8098/search/index/animals
  = not found
 
  What I don't understand is why it believes the index is the bucket name
 and
  not the index I created for it?
 
  riak-admin bucket-type create animals
 '{props:{search_index:famous}}'
  riak-admin bucket-type activate animals
 
  Shouldn't it be looking for a famous index instead of an animals
 index??
 
  Thanks!
  Alex
 
 
  On Mon, Aug 18, 2014 at 4:26 PM, Luke Bakken lbak...@basho.com wrote:
 
  What is the output of this command? Please replace RIAK_HOST and
  name_of_the_bucket with the correct information:
 
  curl $RIAK_HOST/search/index/name_of_the_bucket
 
  If the above returns a 404, please use this guide to ensure you've
  created the index correctly:
 
  http://docs.basho.com/riak/2.0.0/dev/using/search/
 
  If you expect the index to be there and it is not, the solr.log file
  in /var/log/riak could provide a clue.
 
  --
  Luke Bakken
  CSE
  lbak...@basho.com
 
 
  On Mon, Aug 18, 2014 at 6:59 AM, Alex De la rosa
  alex.rosa@gmail.com wrote:
   Hi there,
  
   I had been following the documentation [
   http://docs.basho.com/riak/2.0.0/dev/using/search/ ] about Riak
 Search
   and
   the code provided in the site doesn't seem to work?
  
   Everything I try ends up with an error saying no index found taking
 the
   name
   of the bucket as a not found index :(
  
   riak.RiakError: 'No index name_of_the_bucket found.'
  
   Somebody knows what's going on?
  
   Thanks!
   Alex

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Riak Search Issue

2014-08-18 Thread Luke Bakken
Alex -

Let's take a step back and try out the famous index and animals
bucket type, which you have confirmed are set up correctly. This
(untested) code should create an object (cat-1) in the cats bucket
(within the animals bucket type), which will then be indexed by the
famous index:

bucket = client.bucket_type('animals').bucket('cats')
obj = RiakObject(client, bucket, 'cat-1')
obj.content_type = 'application/json'
obj.data = { 'name': 'Felix', 'species': 'Felis catus' }
obj.store()

--
Luke Bakken
CSE
lbak...@basho.com

On Mon, Aug 18, 2014 at 7:50 AM, Alex De la rosa
alex.rosa@gmail.com wrote:
 Hi Luke,

 I also tried with a normal bucket cats using the type animals as the
 documentation seemed to suggest and gave me the same error but this time
 saying that cats was not found as an index... so... still no clue how to
 do it.

 This is an alternate code I did looking at the Python client API
 documentation, etc...

 client.create_search_index('men')
 bucket = client.bucket('accounts')
 bucket.enable_search()
 bucket.set_property('search_index', 'men')
 key = bucket.new('alex', data={username:Alex,age:25,sex:male},
 content_type='application/json')
 key.store()
 print bucket.search('sex=male')

 Again, it says accounts is not an index... in this code no bucket types
 are used, just a plain bucket accounts... what is wrong? what is missing
 for it to work??

 This is really frustrating.

 Thanks,
 Alex


 On Mon, Aug 18, 2014 at 4:44 PM, Luke Bakken lbak...@basho.com wrote:

 Hi Alex -

 You correctly created the famous index, as well as correctly
 associated it with the bucket *type* animals. Note that a bucket
 type is not the same thing as a bucket in previous versions of Riak. A
 bucket type is a way to give 1 or more buckets within that type the
 same properties. You'll have to use different code in your Riak client
 to use bucket types:

 http://docs.basho.com/riak/2.0.0/dev/advanced/bucket-types/

 --
 Luke Bakken
 CSE
 lbak...@basho.com

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Riak Search Issue

2014-08-18 Thread Alex De la rosa
Hi Luke,

Same error:

bucket = client.bucket_type('animals').bucket('cats')
bucket.enable_search()
bucket.set_property('search_index', 'famous') # NEW: Setting the search
index to the bucket
key = bucket.new('feliz', data={name:Felix,species:Felis catus},
content_type='application/json')
key.store()
print bucket.search('name=Felix')

Output:

Traceback (most recent call last):
  File x.py, line 11, in module
print bucket.search('name=Felix')
  File /usr/local/lib/python2.7/dist-packages/riak/bucket.py, line 420,
in search
return self._client.fulltext_search(self.name, query, **params)
  File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
line 184, in wrapper
return self._with_retries(pool, thunk)
  File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
line 126, in _with_retries
return fn(transport)
  File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
line 182, in thunk
return fn(self, transport, *args, **kwargs)
  File /usr/local/lib/python2.7/dist-packages/riak/client/operations.py,
line 573, in fulltext_search
return transport.search(index, query, **params)
  File
/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/transport.py,
line 564, in search
MSG_CODE_SEARCH_QUERY_RESP)
  File
/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
line 50, in _request
return self._recv_msg(expect)
  File
/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
line 142, in _recv_msg
raise RiakError(err.errmsg)
riak.RiakError: 'No index cats found.'

Thanks,
Alex


On Mon, Aug 18, 2014 at 5:00 PM, Luke Bakken lbak...@basho.com wrote:

 Alex -

 Let's take a step back and try out the famous index and animals
 bucket type, which you have confirmed are set up correctly. This
 (untested) code should create an object (cat-1) in the cats bucket
 (within the animals bucket type), which will then be indexed by the
 famous index:

 bucket = client.bucket_type('animals').bucket('cats')
 obj = RiakObject(client, bucket, 'cat-1')
 obj.content_type = 'application/json'
 obj.data = { 'name': 'Felix', 'species': 'Felis catus' }
 obj.store()

 --
 Luke Bakken
 CSE
 lbak...@basho.com

 On Mon, Aug 18, 2014 at 7:50 AM, Alex De la rosa
 alex.rosa@gmail.com wrote:
  Hi Luke,
 
  I also tried with a normal bucket cats using the type animals as the
  documentation seemed to suggest and gave me the same error but this time
  saying that cats was not found as an index... so... still no clue how
 to
  do it.
 
  This is an alternate code I did looking at the Python client API
  documentation, etc...
 
  client.create_search_index('men')
  bucket = client.bucket('accounts')
  bucket.enable_search()
  bucket.set_property('search_index', 'men')
  key = bucket.new('alex', data={username:Alex,age:25,sex:male},
  content_type='application/json')
  key.store()
  print bucket.search('sex=male')
 
  Again, it says accounts is not an index... in this code no bucket types
  are used, just a plain bucket accounts... what is wrong? what is
 missing
  for it to work??
 
  This is really frustrating.
 
  Thanks,
  Alex
 
 
  On Mon, Aug 18, 2014 at 4:44 PM, Luke Bakken lbak...@basho.com wrote:
 
  Hi Alex -
 
  You correctly created the famous index, as well as correctly
  associated it with the bucket *type* animals. Note that a bucket
  type is not the same thing as a bucket in previous versions of Riak. A
  bucket type is a way to give 1 or more buckets within that type the
  same properties. You'll have to use different code in your Riak client
  to use bucket types:
 
  http://docs.basho.com/riak/2.0.0/dev/advanced/bucket-types/
 
  --
  Luke Bakken
  CSE
  lbak...@basho.com

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Riak Search Issue

2014-08-18 Thread Luke Bakken
Hi Alex,

I'll work on reproducing this error, thank you for the details. I'm
assuming you're using the 2.1.0rc1 version of the Python client
available here:

https://pypi.python.org/pypi?:action=displayname=riak#downloads

--
Luke Bakken
CSE
lbak...@basho.com


On Mon, Aug 18, 2014 at 8:47 AM, Alex De la rosa
alex.rosa@gmail.com wrote:
 Hi Luke,

 Same error:

 bucket = client.bucket_type('animals').bucket('cats')
 bucket.enable_search()
 bucket.set_property('search_index', 'famous') # NEW: Setting the search
 index to the bucket
 key = bucket.new('feliz', data={name:Felix,species:Felis catus},
 content_type='application/json')
 key.store()
 print bucket.search('name=Felix')

 Output:

 Traceback (most recent call last):
   File x.py, line 11, in module
 print bucket.search('name=Felix')
   File /usr/local/lib/python2.7/dist-packages/riak/bucket.py, line 420, in
 search
 return self._client.fulltext_search(self.name, query, **params)
   File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
 line 184, in wrapper
 return self._with_retries(pool, thunk)
   File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
 line 126, in _with_retries
 return fn(transport)
   File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
 line 182, in thunk
 return fn(self, transport, *args, **kwargs)
   File /usr/local/lib/python2.7/dist-packages/riak/client/operations.py,
 line 573, in fulltext_search
 return transport.search(index, query, **params)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/transport.py,
 line 564, in search
 MSG_CODE_SEARCH_QUERY_RESP)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
 line 50, in _request
 return self._recv_msg(expect)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
 line 142, in _recv_msg
 raise RiakError(err.errmsg)
 riak.RiakError: 'No index cats found.'

 Thanks,
 Alex


 On Mon, Aug 18, 2014 at 5:00 PM, Luke Bakken lbak...@basho.com wrote:

 Alex -

 Let's take a step back and try out the famous index and animals
 bucket type, which you have confirmed are set up correctly. This
 (untested) code should create an object (cat-1) in the cats bucket
 (within the animals bucket type), which will then be indexed by the
 famous index:

 bucket = client.bucket_type('animals').bucket('cats')
 obj = RiakObject(client, bucket, 'cat-1')
 obj.content_type = 'application/json'
 obj.data = { 'name': 'Felix', 'species': 'Felis catus' }
 obj.store()

 --
 Luke Bakken
 CSE
 lbak...@basho.com

 On Mon, Aug 18, 2014 at 7:50 AM, Alex De la rosa
 alex.rosa@gmail.com wrote:
  Hi Luke,
 
  I also tried with a normal bucket cats using the type animals as the
  documentation seemed to suggest and gave me the same error but this time
  saying that cats was not found as an index... so... still no clue how
  to
  do it.
 
  This is an alternate code I did looking at the Python client API
  documentation, etc...
 
  client.create_search_index('men')
  bucket = client.bucket('accounts')
  bucket.enable_search()
  bucket.set_property('search_index', 'men')
  key = bucket.new('alex', data={username:Alex,age:25,sex:male},
  content_type='application/json')
  key.store()
  print bucket.search('sex=male')
 
  Again, it says accounts is not an index... in this code no bucket
  types
  are used, just a plain bucket accounts... what is wrong? what is
  missing
  for it to work??
 
  This is really frustrating.
 
  Thanks,
  Alex
 
 
  On Mon, Aug 18, 2014 at 4:44 PM, Luke Bakken lbak...@basho.com wrote:
 
  Hi Alex -
 
  You correctly created the famous index, as well as correctly
  associated it with the bucket *type* animals. Note that a bucket
  type is not the same thing as a bucket in previous versions of Riak. A
  bucket type is a way to give 1 or more buckets within that type the
  same properties. You'll have to use different code in your Riak client
  to use bucket types:
 
  http://docs.basho.com/riak/2.0.0/dev/advanced/bucket-types/
 
  --
  Luke Bakken
  CSE
  lbak...@basho.com



___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Riak Search Issue

2014-08-18 Thread Alex De la rosa
Hi Luke,

Yes, I'm using the version 2.1.0rc1 installed via PIP as explained by Sean
in another thread here.

Thanks,
Alex


On Mon, Aug 18, 2014 at 5:57 PM, Luke Bakken lbak...@basho.com wrote:

 Hi Alex,

 I'll work on reproducing this error, thank you for the details. I'm
 assuming you're using the 2.1.0rc1 version of the Python client
 available here:

 https://pypi.python.org/pypi?:action=displayname=riak#downloads

 --
 Luke Bakken
 CSE
 lbak...@basho.com


 On Mon, Aug 18, 2014 at 8:47 AM, Alex De la rosa
 alex.rosa@gmail.com wrote:
  Hi Luke,
 
  Same error:
 
  bucket = client.bucket_type('animals').bucket('cats')
  bucket.enable_search()
  bucket.set_property('search_index', 'famous') # NEW: Setting the search
  index to the bucket
  key = bucket.new('feliz', data={name:Felix,species:Felis catus},
  content_type='application/json')
  key.store()
  print bucket.search('name=Felix')
 
  Output:
 
  Traceback (most recent call last):
File x.py, line 11, in module
  print bucket.search('name=Felix')
File /usr/local/lib/python2.7/dist-packages/riak/bucket.py, line
 420, in
  search
  return self._client.fulltext_search(self.name, query, **params)
File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
  line 184, in wrapper
  return self._with_retries(pool, thunk)
File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
  line 126, in _with_retries
  return fn(transport)
File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
  line 182, in thunk
  return fn(self, transport, *args, **kwargs)
File
 /usr/local/lib/python2.7/dist-packages/riak/client/operations.py,
  line 573, in fulltext_search
  return transport.search(index, query, **params)
File
 
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/transport.py,
  line 564, in search
  MSG_CODE_SEARCH_QUERY_RESP)
File
 
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
  line 50, in _request
  return self._recv_msg(expect)
File
 
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
  line 142, in _recv_msg
  raise RiakError(err.errmsg)
  riak.RiakError: 'No index cats found.'
 
  Thanks,
  Alex
 
 
  On Mon, Aug 18, 2014 at 5:00 PM, Luke Bakken lbak...@basho.com wrote:
 
  Alex -
 
  Let's take a step back and try out the famous index and animals
  bucket type, which you have confirmed are set up correctly. This
  (untested) code should create an object (cat-1) in the cats bucket
  (within the animals bucket type), which will then be indexed by the
  famous index:
 
  bucket = client.bucket_type('animals').bucket('cats')
  obj = RiakObject(client, bucket, 'cat-1')
  obj.content_type = 'application/json'
  obj.data = { 'name': 'Felix', 'species': 'Felis catus' }
  obj.store()
 
  --
  Luke Bakken
  CSE
  lbak...@basho.com
 
  On Mon, Aug 18, 2014 at 7:50 AM, Alex De la rosa
  alex.rosa@gmail.com wrote:
   Hi Luke,
  
   I also tried with a normal bucket cats using the type animals as
 the
   documentation seemed to suggest and gave me the same error but this
 time
   saying that cats was not found as an index... so... still no clue
 how
   to
   do it.
  
   This is an alternate code I did looking at the Python client API
   documentation, etc...
  
   client.create_search_index('men')
   bucket = client.bucket('accounts')
   bucket.enable_search()
   bucket.set_property('search_index', 'men')
   key = bucket.new('alex',
 data={username:Alex,age:25,sex:male},
   content_type='application/json')
   key.store()
   print bucket.search('sex=male')
  
   Again, it says accounts is not an index... in this code no bucket
   types
   are used, just a plain bucket accounts... what is wrong? what is
   missing
   for it to work??
  
   This is really frustrating.
  
   Thanks,
   Alex
  
  
   On Mon, Aug 18, 2014 at 4:44 PM, Luke Bakken lbak...@basho.com
 wrote:
  
   Hi Alex -
  
   You correctly created the famous index, as well as correctly
   associated it with the bucket *type* animals. Note that a bucket
   type is not the same thing as a bucket in previous versions of Riak.
 A
   bucket type is a way to give 1 or more buckets within that type the
   same properties. You'll have to use different code in your Riak
 client
   to use bucket types:
  
   http://docs.basho.com/riak/2.0.0/dev/advanced/bucket-types/
  
   --
   Luke Bakken
   CSE
   lbak...@basho.com
 
 

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Riak Search Issue

2014-08-18 Thread Eric Redmond
Alex,

Don't call enable_search(). That enables *old* Riak Search (it sets the 
property search:true). To revert that setting, bucket.set_property(search, 
False)



On Aug 18, 2014, at 10:55 AM, Alex De la rosa alex.rosa@gmail.com wrote:

 Hi Luke,
 
 As an alternative version and following the Python Client Documentation I 
 tried these steps without a bucket_type (although I ended in the same error):
 
                
           
 STEP 1: CREATE SEARCH INDEX: mywantedindex
                
           
 PYTHON:
   client.create_search_index('mywantedindex')
 
                
           
 STEP 2: VERIFY INDEX
                
           
 CURL:
   http://RIAK:8098/search/index/mywantedindex
   = {name:mywantedindex,n_val:3,schema:_yz_default}
 
                
           
 STEP 3: CREATE BUCKET: pleasework3
                
           
 PYTHON:
   bucket = client.bucket('pleasework3')
   bucket.enable_search()
   bucket.set_property('search_index', 'mywantedindex')
 
                
           
 STEP 4: VERIFY BUCKET PROPS
                
           
 CURL:
   http://RIAK:8098/riak/pleasework3
   = 
 {props:{allow_mult:false,basic_quorum:false,big_vclock:50,chash_keyfun:{mod:riak_core_util,fun:chash_std_keyfun},dvv_enabled:false,dw:quorum,last_write_wins:false,linkfun:{mod:riak_kv_wm_link_walker,fun:mapreduce_linkfun},n_val:3,name:pleasework3,notfound_ok:true,old_vclock:86400,postcommit:[],pr:0,precommit:[],pw:0,r:quorum,rw:quorum,search:true,search_index:mywantedindex,small_vclock:50,w:quorum,young_vclock:20}}
 
                
           
 RESULT: ERROR!
                
           
 PYTHON:
   print bucket.search('name=Felix')
   = riak.RiakError: 'No index pleasework3 found.'
 
 At least I can see the search_index:mywantedindex prop set up properly in 
 the bucket but still getting the same error no matter what I try; I think is 
 possible there is a bug in the Python client?
 
 Thanks,
 Alex
 
 
 On Mon, Aug 18, 2014 at 6:14 PM, Alex De la rosa alex.rosa@gmail.com 
 wrote:
 In case is of help, here are the steps I followed:
 
                
           
 STEP 1: CREATE SEARCH INDEX: mywantedindex
                
           
 PYTHON:
   client.create_search_index('mywantedindex')
 
                
           
 STEP 2: VERIFY INDEX
                
           
 CURL:
   http://RIAK:8098/search/index/mywantedindex
   = {name:mywantedindex,n_val:3,schema:_yz_default}
 
                
           
 STEP 3: CREATE BUCKET TYPE: anothertry
                
           
 SHELL:
   riak-admin bucket-type create anothertry 
 '{props:{search_index:mywantedindex}}'
   = anothertry created
   riak-admin bucket-type activate anothertry
   = anothertry has been activated
 
                
           
 STEP 4: CREATE BUCKET TO STORE OBJECTS: pleasework
                
           
 PYTHON:
   bucket = client.bucket_type('anothertry').bucket('pleasework')
   bucket.enable_search()
   bucket.set_property('search_index', 'mywantedindex')
   key = bucket.new('cat-1', data={name:Felix,species:Felis catus}, 
 content_type='application/json')
   key.store()
   print 

Re: Riak Search Issue

2014-08-18 Thread Sean Cribbs
Don't use bucket with 2 arguments, use
client.bucket_type('futbolistas').bucket('fcb'). This makes your
intent more clear. The 2-arity version of bucket() was for
backwards-compatibility.

On Mon, Aug 18, 2014 at 4:10 PM, Eric Redmond eredm...@basho.com wrote:
 Alex,

 You may have discovered a legitimate bug in the python driver. In the
 meantime, if you give your bucket and index the same name, you can proceed,
 while we investigate.

 Thanks,
 Eric


 On Aug 18, 2014, at 2:00 PM, Alex De la rosa alex.rosa@gmail.com
 wrote:

 Yes, I did it in purpose, because I did so many testings that I wanted to
 start fresh... so I kinda translated the documentation, but that is
 irrelevant to the case.

 Thanks,
 Alex


 On Mon, Aug 18, 2014 at 10:59 PM, Eric Redmond eredm...@basho.com wrote:

 Your steps seemed to have named the index famoso.

 Eric


 On Aug 18, 2014, at 1:56 PM, Alex De la rosa alex.rosa@gmail.com
 wrote:

 Ok, I found the first error in the documentation, parameters are in
 reverse order:

 bucket = client.bucket('animals', 'cats')

 should be:

 bucket = client.bucket('cats', 'animals')

 Now I could save and it found the bucket type: bucket =
 client.bucket('fcb','futbolistas') VS bucket = client.bucket('futbolistas',
 'fcb')

 However, even fixing that, the next step fails as it was failing before:

               
         
 PYTHON:
   bucket = client.bucket('fcb','futbolistas')
   results = bucket.search('name_s:Lion*')
   print results
               
         
 Traceback (most recent call last):
   File x.py, line 13, in module
 results = bucket.search('name_s:Lion*')
   File /usr/local/lib/python2.7/dist-packages/riak/bucket.py, line 420,
 in search
 return self._client.fulltext_search(self.name, query, **params)
   File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
 line 184, in wrapper
 return self._with_retries(pool, thunk)
   File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
 line 126, in _with_retries
 return fn(transport)
   File /usr/local/lib/python2.7/dist-packages/riak/client/transport.py,
 line 182, in thunk
 return fn(self, transport, *args, **kwargs)
   File /usr/local/lib/python2.7/dist-packages/riak/client/operations.py,
 line 573, in fulltext_search
 return transport.search(index, query, **params)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/transport.py,
 line 564, in search
 MSG_CODE_SEARCH_QUERY_RESP)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
 line 50, in _request
 return self._recv_msg(expect)
   File
 /usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py,
 line 142, in _recv_msg
 raise RiakError(err.errmsg)
 riak.RiakError: 'No index fcb found.'

 Again it says fcb index not found... and this time I fully followed the
 right documentation and didn't use bucket.enable_search()

 Thanks,
 Alex


 On Mon, Aug 18, 2014 at 10:49 PM, Alex De la rosa
 alex.rosa@gmail.com wrote:

 Hi Eric,

 I'm sorry but I followed the documentation that you provided me and still
 raises issues:

              
          
 STEP 1: Create Index: famoso
              
          
 PYTHON:
   client.create_search_index('famoso')

              
          
 STEP 2: Create Bucket Type: futbolistas
              
          
 SHELL:
   riak-admin bucket-type create futbolistas
 '{props:{search_index:famoso}}'
   = futbolistas created
   riak-admin bucket-type activate futbolistas
   = futbolistas has been activated

              
          
 STEP 3: Create Bucket and Add data: fcb
              
          
 PYTHON:
   bucket = client.bucket('futbolistas', 'fcb')
   c = bucket.new('lionel', {'name_s': 'Lionel', 'age_i': 30, 'leader_b':
 True})
   c.store()

              
          
 ERROR: This time it doesn't even let me save data into Riak
              
          
 Traceback (most recent call last):
   File x.py, line 10, in module
 c = bucket.new('lionel', {'name_s': 'Lionel', 

Re: Riak Search Issue

2014-08-18 Thread Alex De la rosa
Hi Eric,

Cool! This new syntax really worked :) even on different bucket names :) It
has been driving me crazy all day... haha, glad is finally sorted out.

PYTHON:
results = client.fulltext_search('famoso', 'name_s:Lio*')
print results

OUTPUT:
{'num_found': 2, 'max_score': 1.0, 'docs': [{u'age_i': u'30', u'name_s':
u'Lionel', u'_yz_rk': u'lionel', u'_yz_rb': u'fcb', u'score':
u'1.e+00', u'leader_b': u'true', u'_yz_id':
u'1*futbolistas*fcb*lionel*59', u'_yz_rt': u'futbolistas'}, {u'age_i':
u'30', u'name_s': u'Lionel', u'_yz_rk': u'lionel', u'_yz_rb': u'famoso',
u'score': u'1.e+00', u'leader_b': u'true', u'_yz_id':
u'1*futbolistas*famoso*lionel*8', u'_yz_rt': u'futbolistas'}]}

Thanks!
Alex


On Mon, Aug 18, 2014 at 11:33 PM, Eric Redmond eredm...@basho.com wrote:

 Alex,

 I was mistaken about the bucket search. The documentation is wrong, and
 the API is weirded for backward compatibility reasons. You should be able
 to search by index name this way.

 client.fulltext_search(index, query, **params)

 We'll update the docs to match.

 Eric


 On Aug 18, 2014, at 2:29 PM, Alex De la rosa alex.rosa@gmail.com
 wrote:

 Hi Sean,

 Yeah, I opted to follow that pattern on my latest attempt as I see it more
 clear that the way in the documentation. Still same issue although with
 Eric we saw it works fine when index and bucket has the same name.

 Thanks!
 Alex


 On Mon, Aug 18, 2014 at 11:27 PM, Sean Cribbs s...@basho.com wrote:

 Don't use bucket with 2 arguments, use
 client.bucket_type('futbolistas').bucket('fcb'). This makes your
 intent more clear. The 2-arity version of bucket() was for
 backwards-compatibility.




___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com