lib/picky/search.rb in picky-4.0.4 vs lib/picky/search.rb in picky-4.0.5
- old
+ new
@@ -6,15 +6,14 @@
#
# A Picky Search is an object which:
# * holds one or more indexes
# * offers an interface to query these indexes.
#
- # You connect URL paths to indexes via a Query.
+ # Example:
+ # search = Picky::Search.new index1, index2
+ # search.search 'query'
#
- # We recommend to not use this directly, but connect it to an URL and query through one of these
- # (Protip: Use "curl 'localhost:8080/query/path?query=exampletext')" in a Terminal.
- #
class Search
include API::Search::Boost
include Helpers::Measuring
@@ -23,10 +22,11 @@
:ignore_unassigned
attr_accessor :tokenizer,
:boosts
delegate :ignore,
+ :only,
:to => :indexes
# Takes:
# * A number of indexes
#
@@ -36,11 +36,11 @@
# searching removes_characters: /[^a-z]/ # etc.
# boosts [:author, :title] => +3,
# [:title, :isbn] => +1
# end
#
- def initialize *index_definitions
- @indexes = Query::Indexes.new *index_definitions
+ def initialize *indexes
+ @indexes = Query::Indexes.new *indexes
instance_eval(&Proc.new) if block_given?
@tokenizer ||= Tokenizer.searching # THINK Not dynamic. Ok?
@boosts ||= Query::Boosts.new
\ No newline at end of file