lib/picky/search.rb in picky-4.5.10 vs lib/picky/search.rb in picky-4.5.11
- old
+ new
@@ -173,10 +173,13 @@
# Parameters:
# * text: The search text.
# * ids = 20: The amount of ids to calculate (with offset).
# * offset = 0: The offset from which position to return the ids. Useful for pagination.
#
+ # Options:
+ # * unique: Whether to return unique ids.
+ #
# Note: The Rack adapter calls this method after unravelling the HTTP request.
#
def search text, ids = 20, offset = 0, options = {}
search_with tokenized(text), ids.to_i, offset.to_i, text, options[:unique]
end
@@ -211,18 +214,21 @@
# Delegates the tokenizing to the query tokenizer.
#
# Parameters:
# * text: The string to tokenize.
+ # * partialize_last: Whether to partialize the last token
#
+ # Note: By default, the last token is always partial.
+ #
# Returns:
# * A Picky::Query::Tokens instance.
#
- def tokenized text
+ def tokenized text, partialize_last = true
tokens, originals = tokenizer.tokenize text
tokens = Query::Tokens.processed tokens, originals || tokens, @ignore_unassigned
# tokens.symbolize # TODO Symbols.
- tokens.partialize_last # Note: In the standard Picky search, the last token is always partial.
+ tokens.partialize_last if partialize_last
tokens
end
# Gets sorted allocations for the tokens.
#
\ No newline at end of file