Riak / Search via Python Client, no Results from Server

claudef at br.ibm.com claudef at br.ibm.com
Wed May 23 15:15:50 EDT 2012


Dear Shuhao Wu, 

Thanks so much, that was the key to the solution! 

rel/riak/bin/search-cmd install ramtest
:: Installing Riak Search <--> KV hook on bucket 'ramtest'.

I also needed to exclude all key/data from the bucket and reinsert them 
again to make use of the pre-commit hook feature. Once done, the search 
started working. 

Happy, 

Regards, 
Claude 



Claude Falbriard 
Certified IT Specialist L2 - Middleware
AMS Hortolândia / SP - Brazil
phone:    +55 19 9837 0789
cell:         +55 13 8117 3316
e-mail:    claudef at br.ibm.com




From:   Shuhao Wu <admin at thekks.net>
To:     claudef at br.ibm.com
Cc:     riak-users at lists.basho.com
Date:   23/05/2012 15:24
Subject:        Re: Riak / Search via Python Client, no Results from 
Server



Yes. You have to do search-cmd install bucketname I believe 
Shuhao
On May 23, 2012 11:20 AM, <claudef at br.ibm.com> wrote:
Thanks Sean for the hint .. sure, you right, that wildcard syntax was too 
short !   

Still like this, the main issue remains. The search function is not yet 
activated at the server side, even having the parameter set  to true in 
the /etc/app.config file.    Whatever  syntax sent to the server is not 
checked, nor validated, nor executed.  I've restarted the server with 
bin/riak stop and bin/riak start .   

The same error also shows up at the sample bucket  'user' throwing 0 
results (with no error message).  I'm using the git version built from 
source. 
  
at rel/riak/etc/app.config 
%% Riak Search Config 
 {riak_search, [ 
                %% To enable Search functionality set this 'true'. 
                {enabled, true} 
               ]},

Any further settings required to activate the server-side search function? 


Log 
C:\Python\myprojects\riak>python basic_search.py 
starts at : 2012-05-23 12:12:31.718000 
How many keys in the bucket: 500 
Resultset: [] 

Source: 
search_string = 'cEDO:[aaaa TO ZZZZ]' 
bucketname = 'ramtest' 
startd = datetime.now() 
print "starts at : " + str(startd) 
start = time() 
# 
try: 
    client = riak.RiakClient(host='zbra') 
    data_bucket = client.bucket(bucketname) 
    mykeys = data_bucket.get_keys() 
    howmany = len(mykeys) 
    print "How many keys in the bucket: "+ str(howmany)   
    resultset = client.search(bucketname, 
search_string).map('Riak.mapValuesJson').run() 
    print "Resultset: " + str(resultset) 


Regards, 
Claude 


Claude Falbriard 
Certified IT Specialist L2 - Middleware
AMS Hortolândia / SP - Brazil
phone:    +55 19 9837 0789
cell:         +55 13 8117 3316
e-mail:    claudef at br.ibm.com




From:        Sean Cribbs <sean at basho.com> 
To:        claudef at br.ibm.com 
Cc:        riak-users at lists.basho.com 
Date:        22/05/2012 17:52 
Subject:        Re: Riak / Search via Python Client, no Results from 
Server 



Claude, 

Generally your terms in wildcard queries need to be at least two or three 
characters (I don't remember which), so either way A* is not going to work 
as a search. 

On Tue, May 22, 2012 at 4:46 PM, <claudef at br.ibm.com> wrote: 
Dear colleagues. 

Not able to run a pattern search through the Python query. The server 
search option was enabled with the true setting in the app.config file 
(line 165) and the server was restarted.   Checking the Riak console log 
below,  I see the search being started, but no results are returned to the 
client. My version is "git" built from source.   

Console Log 
2012-05-22 15:07:50.853 [info] <0.7.0> Application riak_search started on 
node 'riak at 172.24.200.158' 
2012-05-22 15:07:50.854 [info] <0.7.0> Application basho_stats started on 
node 'riak at 172.24.200.158' 
2012-05-22 15:07:50.865 [info] <0.7.0> Application runtime_tools started 
on node 'riak at 172.24.200.158' 
2012-05-22 15:07:50.866 [info] <0.7.0> Application public_key started on 
node 'riak at 172.24.200.158' 
2012-05-22 15:07:50.882 [info] <0.7.0> Application ssl started on node '
riak at 172.24.200.158' 
2012-05-22 15:07:50.944 [info] 
<0.1558.0>@riak_core:wait_for_application:390 Wait complete for 
application riak_search (0 seconds) 
2012-05-22 15:07:51.034 [info] <0.1490.0>@riak_core:wait_for_service:410 
Wait complete for service riak_search (0 seconds) 

Source code:  Read all data starting with Capital Letter A, cEDO is the 
data field name 
try: 
    client = riak.RiakClient(host='xxxxxxxx') 
    data_bucket = client.bucket(bucketname) 
    mykeys = data_bucket.get_keys() 
    howmany = len(mykeys) 
    print "How many keys in the bucket: "+ str(howmany)     
    search_query = client.search(bucketname, 'cEDO:A*') 
    print "search query built" 
    resultset = search_query.run() 
    print "result entries found: " + str(len(resultset)) 

Processing log: 
How many keys in the bucket: 500 
search query built 
result entries found: 0 

No further error message is thrown. 

ps .. Also the basic sample from the Python client documentation (bucket= 
'user') shows the same results, 0 entries found by the serach.   
         
http://basho.github.com/riak-python-client/tutorial.html#using-search 

Thanks in advance for your insights. What's missing to start the  Search 
feature, or is something missing in the Lucene syntax ? 

Regards, 
Claude 


Claude Falbriard 
Certified IT Specialist L2 - Middleware
AMS Hortolândia / SP - Brazil
phone:    +55 19 9837 0789
cell:         +55 13 8117 3316
e-mail:    claudef at br.ibm.com

_______________________________________________
riak-users mailing list
riak-users at lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com




-- 
Sean Cribbs <sean at basho.com> 
Software Engineer 
Basho Technologies, Inc. 
http://basho.com/ 


_______________________________________________
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/20120523/8ba5adb7/attachment.html>


More information about the riak-users mailing list