Giter Site home page Giter Site logo

Comments (3)

charl avatar charl commented on July 28, 2024

There is a larger issue here that affects is_indexed?, enable_index! and disable_index!.

Looks like these blocks of code require props['precommit'] to be set or in the very least to be initialised to []:

188     # (Riak Search) Installs a precommit hook that automatically indexes objects
189     # into riak_search.
190     def enable_index!
191       unless is_indexed?
192         self.props = {"precommit" => (props['precommit'] + [SEARCH_PRECOMMIT_HOOK]), "search" => true}
193       end
194     end
195 
196     # (Riak Search) Removes the precommit hook that automatically indexes objects
197     # into riak_search.
198     def disable_index!
199       if is_indexed?
200         self.props = {"precommit" => (props['precommit'] - [SEARCH_PRECOMMIT_HOOK]), "search" => false}
201       end
202     end
203 
204     # (Riak Search) Detects whether the bucket is automatically indexed into
205     # riak_search.
206     # @return [true,false] whether the bucket includes the search indexing hook
207     def is_indexed?
208       props['search'] == true || props['precommit'].include?(SEARCH_PRECOMMIT_HOOK)
209     end

But in my installation of riak (v1.3.1~precise1) and riak-client (v1.1.1) the bucket props are:

irb(main):005:0* bucket.props
=> {"n_val"=>3, "allow_mult"=>false}

from riak-ruby-client.

charl avatar charl commented on July 28, 2024

I've narrowed this down further. The issue seems specific to Excon and Protobufs backends as the default HTTP backend works perfectly fine:

irb(main):047:0* require "riak"; client = Riak::Client.new; bucket_name = "tweets"; bucket = client.bucket bucket_name
=> #<Riak::Bucket {tweets}>
irb(main):048:0> 
irb(main):049:0* bucket.props
=> {"allow_mult"=>false, "basic_quorum"=>false, "big_vclock"=>50, "chash_keyfun"=>{"mod"=>"riak_core_util", "fun"=>"chash_std_keyfun"}, "dw"=>"quorum", "last_write_wins"=>false, "linkfun"=>{"mod"=>"riak_kv_wm_link_walker", "fun"=>"mapreduce_linkfun"}, "n_val"=>3, "name"=>"tweets", "notfound_ok"=>true, "old_vclock"=>86400, "postcommit"=>[], "pr"=>0, "precommit"=>[{"mod"=>"riak_search_kv_hook", "fun"=>"precommit"}], "pw"=>0, "r"=>"quorum", "rw"=>"quorum", "search"=>true, "small_vclock"=>50, "w"=>"quorum", "young_vclock"=>20}
irb(main):050:0> 
irb(main):051:0* bucket.is_indexed?
=> true

from riak-ruby-client.

seancribbs avatar seancribbs commented on July 28, 2024

This is a known limitation of PB that it did not expose all bucket props; the fix is coming in Riak 1.4. For the Excon thing, see #83

from riak-ruby-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.