We’re currently evaluating whether Riak is suitable for our system and have an 
issue with multiple/stale results being returned from Riak search. We’re 
reliably seeing this occur when a record is  deleted and a new one created 
under the same key shortly afterwards – which, based on the _yz_id, causes 
siblings to be created.

Accessing the record through the map datatype only gives us the expected 
record.  We’ve considered de-duplicating the result by ID but this could still 
result in search results where the query matches the old but not the new data. 
The obsolete records in Riak search/Solr never get cleaned up.

Is this a known issue? Are we missing something on inserting/querying the data? 
Is it possible to tie the version of data in the Riak search result to the 
version retrieved from Riak by key?

Below is an example of the Riak search query/result (using Node 
basho-riak-client) and datatype data. The date.value is set to the 
creation/update time.

 var searchOptions = {
    indexName: 'minimals_index',
    q: 'name_register:foo',
    presort: ‘score'
}

riakClient.search(searchOptions, function(err, result) {
  console.log('Search result', err, result);
  callback(err, result);
}

Results:
{ numFound: 6,
  maxScore: 0.35434481501579285,
  docs:
   [ { score: 0.35434482,
       _yz_rb: 'minimals',
       _yz_rt: 'maps',
       _yz_rk: 'test:foo',
       _yz_id: '1*maps*minimals*test:foo*13*2EB6xtIHCicwmARKDJ81tS',
       'date_map._type_register': '_date',
       'date_map._value_register': '2016-02-12T11:39:22.942Z',
       name_register: 'foo',
       owner_register: 'test' },
…
     { score: 0.35434482,
       _yz_rb: 'minimals',
       _yz_rt: 'maps',
       _yz_rk: 'test:foo',
       _yz_id: '1*maps*minimals*test:foo*13*4hNPnHzeJpTc7S6nEW8vNb',
       'date_map._type_register': '_date',
       'date_map._value_register': '2016-02-12T13:28:11.785Z',
       name_register: 'foo',
       owner_register: 'test' } ]
}

Riak get by ID:
$ curl -XGET 
"http://localhost:11098/types/maps/buckets/minimals/datatypes/test:foo";
{"type":"map","value":{"date_map":{"_type_register":"_date","_value_register":"2016-02-12T13:28:11.785Z"},"name_register":"foo","owner_register":"test"},"context":"g2wAAAABaAJtAAAADMHSXwlPAZAxAAAAQmEDag==“}


Thanks,
Peter

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

Reply via email to