fujin (owner)

Revisions

gist: 187693 Download_button fork
public
Public Clone URL: git://gist.github.com/187693.git
Embed All Files: show embed
sudo-irb-rchef-rferret #
1
2
3
4
5
6
7
8
9
10
11
12
aj@AJ-Christensens-MacBook (branch: v0.7.10) ~/Development/chef$ sudo irb -rchef -rferret
>> @index = Ferret::Index::Index.new(:path => Chef::Config[:search_index_path])
=> #<Ferret::Index::Index:0x1023bb0c0 @mon_entering_queue=[], @auto_flush=false, @mon_count=0, @dir=#<Ferret::Store::FSDirectory:0x1023bb070>, default_input_field:id, searchernil, readernil, mon_ownernil, qpnil, options{:lock_retry_time=>2, :analyzer=>#<Ferret::Analysis::StandardAnalyzer:0x1023baf30, :path="/var/chef/search_index", :dir=#<Ferret::Store::FSDirectory:0x1023bb070, :default_field=:*}, @close_dir=true, @default_field=:*, @writer=nil, @mon_waiting_queue=[], @open=true, @id_field=:id, @key=nil>
>> indexes = Hash.new
=> {}
>> @index.search_each("index_name:*", :limit => :all) do |id, score|
?> indexes[@index.doc(id)["index_name"]] = true
>> end
=> 3
>> indexes.keys
=> ["node"]