lib/picky/internals/query/token.rb in picky-2.0.0.pre2 vs lib/picky/internals/query/token.rb in picky-2.0.0.pre3
- old
+ new
@@ -1,9 +1,9 @@
module Internals
module Query
-
+
# This is a query token. Together with other tokens it makes up a query.
#
# It remembers the original form, and and a normalized form.
#
# It also knows whether it needs to look for similarity (bla~), or whether it is a partial (bla*).
@@ -93,11 +93,11 @@
#
@@illegals = /["*~]/
def remove_illegals
@text.gsub! @@illegals, '' unless @text.blank?
end
-
+
# Visitor for tokenizer.
#
# TODO Rewrite!!!
#
def tokenize_with tokenizer
@@ -113,14 +113,14 @@
end
end
# Returns an array of possible combinations.
#
- def possible_combinations_in type
- type.possible_combinations self
+ def possible_combinations_in index
+ index.possible_combinations self
end
-
+
# Returns a token with the next similar text.
#
# TODO Rewrite this. It is hard to understand. Also spec performance.
#
def next_similar_token category
@@ -166,33 +166,33 @@
}
@@solr_fuzzy_mapping.default = :'~0.9'
def to_solr
blank? ? '' : (to_s + @@solr_fuzzy_mapping[@text.size].to_s)
end
-
+
#
#
def to_result
[@original, @text]
end
-
+
# Internal identifier.
#
def identifier
"#{similar?? :similarity : :index}:#{@text}"
end
-
+
# Displays the qualifier text and the text, joined.
#
# e.g. name:meier
#
def to_s
[@qualifier, @text].compact.join ':'
end
-
+
private
-
+
# Splits text into a qualifier and text.
#
# Returns [qualifier, text].
#
def split unqualified_text
@@ -203,9 +203,9 @@
[qualifier, text]
end
end
end
-
+
end
-
+
end
\ No newline at end of file