secondary indexes for timestamp

Norman Khine norman at khine.net
Thu Mar 1 04:56:52 EST 2012


Hello again,
I am trying to figure out how to return my search results from this
code, i am using the riak-js client:


				var time = +new Date();
				var origin;
				db.enableIndex('users');
				var results = db.search('users', { timestamp:
[1330536456424,1330593323542] });
				console.log(results);
				response.writeHead(200, {
		                                   'Content-Type': 'image/gif'
		                                });
				origin = /\/(.*)\.gif/.exec(request.url);
				if (origin) {
					var ip = "128.121.60.133"
					//var ip = request.connection.remoteAddress;
					city = new City(__dirname + "/GeoLiteCity.dat");
					city.lookup(ip, function(err, location) {
							obj = {
								city: location.city
	                                                      , latitude:
location.latitude
	                                                      , longitude:
location.longitude
	                                                      , ip: ip
							, timestamp: time
							}
							self.bayeux.getClient().publish('/stat', obj);
							// write to riak cluster
							db.save('users', 'norman', obj, { index: {timestamp: time} });
							console.log('was saved in the riak cluster');
					});



the console.log(results);

returns 'undefined'

when i run the examples from the https://wiki.basho.com/Secondary-Indexes.html
i get this error:

<html><head><title>500 Internal Server
Error</title></head><body><h1>Internal Server Error</h1>The server
encountered an error while processing this
request:<br><pre>{error,{error,{indexes_not_supported,riak_kv_bitcask_backend}}}</pre><P><HR><ADDRESS>mochiweb+webmachine
web server</ADDRESS></body></html>%

here is the full output http://www.pastie.org/3495097

if i do

curl http://localhost:8098/solr/users/select?q=timestamp:1330593323542

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">4</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">timestamp:1330593323542</str>
<str name="q.op">or</str>
<str name="filter"/>
<str name="df">value</str>
<str name="wt">standard</str>
<str name="version">1.1</str>
<str name="rows">0</str>
</lst>
</lst>
<result name="response" numFound="0" start="0" maxScore="0.0"></result>
</response>

so i am not sure i am indexing the timestamp correctly.

any advice much appreciated



-- 
%>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or
chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] )




More information about the riak-users mailing list