lib/picky/application.rb in picky-3.0.1 vs lib/picky/application.rb in picky-3.1.0

- old
+ new

@@ -13,27 +13,27 @@ # The generator # $ picky generate unicorn_server project_name # will generate an example <tt>project_name/app/application.rb</tt> file for you # with some example code inside. # - # == Indexes::Memory.new(name) + # == Index.new(name) # - # Next, define where your data comes from, creating an <tt>Index</tt>. You use the <tt>Indexes::Memory.new</tt> method for that: - # my_index = Indexes::Memory.new :some_index_name + # Next, define where your data comes from, creating an <tt>Index</tt>. You use the <tt>Index.new</tt> method for that: + # my_index = Index.new :some_index_name # You give the index a name (or identifier), and a source (see Sources), where its data comes from. Let's do that: # class MyGreatSearch < Application # - # books = Indexes::Memory.new :books do + # books = Index.new :books do # source Sources::CSV.new(:title, :author, :isbn, file:'app/library.csv') # end # # end # Now we have an index <tt>books</tt>. # # That on itself won't do much good. # - # Note that a Redis index is also available: Indexes::Redis.new. + # Note that a Redis index is also available: Index.new. # # == category(identifier, options = {}) # # Picky needs us to define categories on the data. # @@ -41,11 +41,11 @@ # It's best if you look at an example yourself: http://floere.github.com/picky/examples.html # # Let's go ahead and define a category: # class MyGreatSearch < Application # - # books = Indexes::Memory.new :books do + # books = Index.new :books do # source Sources::CSV.new(:title, :author, :isbn, file:'app/library.csv') # category :title # end # # end @@ -68,11 +68,11 @@ # Let's add a URL path (a Route, see http://github.com/floere/picky/wiki/Routing-configuration) to which we can send our queries. We do that with the route method: # route %r{^/books$} => books_query # In full glory: # class MyGreatSearch < Application # - # books = Indexes::Memory.new :books do + # books = Index.new :books do # source Sources::CSV.new(:title, :author, :isbn, file:'app/library.csv') # category :title # end # # route %r{^/books$} => Search.new(books) @@ -132,11 +132,11 @@ # splits_text_on: /[\s\/\-\,\&]+/, # removes_characters_after_splitting: /\./, # substitutes_characters_with: CharacterSubstituters::WestEuropean.new, # maximum_tokens: 4 # - # books = Indexes::Memory.new :books do + # books = Index.new :books do # source Sources::CSV.new(:title, :author, :isbn, file:'app/library.csv') # category :title, # qualifiers: [:t, :title, :titre], # partial: Partial::Substring.new(:from => 1), # similarity: Similarity::DoubleMetaphone.new(2) @@ -161,18 +161,18 @@ # Returns a configured tokenizer that # is used for indexing by default. # def indexing options = {} - Tokenizers::Index.default = Tokenizers::Index.new(options) + Tokenizer.index_default = Tokenizer.new(options) end # Returns a configured tokenizer that # is used for querying by default. # def searching options = {} - Tokenizers::Query.default = Tokenizers::Query.new(options) + Tokenizer.query_default = Tokenizer.new(options) end # Routes. # def route options @@ -238,13 +238,13 @@ end def to_stats <<-APP \033[1mIndexing (default)\033[m: - #{Tokenizers::Index.default.indented_to_s} + #{Tokenizer.index_default.indented_to_s} \033[1mQuerying (default)\033[m: - #{Tokenizers::Query.default.indented_to_s} + #{Tokenizer.query_default.indented_to_s} \033[1mIndexes\033[m: #{Indexes.to_s.indented_to_s} \033[1mRoutes\033[m: \ No newline at end of file