9

I am using Riak Search. At some point, I removed the index from the bucket. After having added some new objects into the bucket, I put the index back on.

When I search by the index, I can't find the objects which were not indexed.

How can I index them now? I think that the solution would be also suitable for other not-indexed legacy buckets as well.

Hao
  • 6,291
  • 9
  • 39
  • 88
  • It seems more like a bug. Did you report it? – Hynek -Pichi- Vychodil Jun 15 '15 at 13:02
  • I think it should happen like this because I removed the index when I added the new objects which obvious were not indexed. – Hao Jun 16 '15 at 03:07
  • 1
    When you add index it should end up in a consistent state regardless your previous actions. Make the minimal reproducible example and report it. – Hynek -Pichi- Vychodil Jun 16 '15 at 08:26
  • I don't get it. The index for example is "famous". I added to the bucket property. And all the objects inserted into the bucket will be indexed here out. Later, I deleted the "famous" index from the property( set search_index to _dont_index_". Then the objects I add now are not indexed. I think this is reasonable. I don't see the bug you see. My question is how to index these missed objects if I want to turn the index back on. Or even, if i want to change to anther index, how can I re-index all the objects in the bucket. – Hao Jun 16 '15 at 08:32
  • 1
    So now there is may be a mismatch in terminology. What I understand as _index_ is most probably something different than you understand. – Hynek -Pichi- Vychodil Jun 16 '15 at 09:28
  • Can you write some sample code? I don´t get the part where you remove and add an index to a bucket. The index is per object, when you create/update a object you can add a secondary index. What are you doing exactly? – rorra Jun 21 '15 at 16:20
  • Check this out http://stackoverflow.com/questions/27389330/is-it-possible-to-force-riak-2-0-to-re-index-data-after-changing-a-schema-witho – Andrei Mărcuţ Jun 24 '15 at 10:25

1 Answers1

1

My solution for that and some similar problems with searchindices on Bucket-Types i use the following procedures (only in development) have no exp. in production with riak now so someone else has to answer that:

  1. delete the searchindex

    riakc_pb_socket:delete_search_index(Pid, <<"XXX">>, []).

  2. Reindex with creation of a new index (in this case with default values applied)

    riakc_pb_socket:create_search_index(Pid, <<"XXX">>, <<"_yz_default">>, []).

after that your index should be updated and you don`t have to change your code anyway....

happy coding with erlang and riak

Canislupax

canislupax
  • 56
  • 3