searchlogic 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/CHANGELOG.rdoc +228 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Manifest +123 -0
  4. data/README.rdoc +383 -0
  5. data/Rakefile +15 -0
  6. data/TODO.rdoc +6 -0
  7. data/examples/README.rdoc +4 -0
  8. data/init.rb +1 -0
  9. data/lib/searchlogic.rb +89 -0
  10. data/lib/searchlogic/active_record/associations.rb +52 -0
  11. data/lib/searchlogic/active_record/base.rb +218 -0
  12. data/lib/searchlogic/active_record/connection_adapters/mysql_adapter.rb +172 -0
  13. data/lib/searchlogic/active_record/connection_adapters/postgresql_adapter.rb +168 -0
  14. data/lib/searchlogic/active_record/connection_adapters/sqlite_adapter.rb +75 -0
  15. data/lib/searchlogic/condition/base.rb +159 -0
  16. data/lib/searchlogic/condition/begins_with.rb +17 -0
  17. data/lib/searchlogic/condition/blank.rb +21 -0
  18. data/lib/searchlogic/condition/child_of.rb +11 -0
  19. data/lib/searchlogic/condition/descendant_of.rb +24 -0
  20. data/lib/searchlogic/condition/ends_with.rb +17 -0
  21. data/lib/searchlogic/condition/equals.rb +27 -0
  22. data/lib/searchlogic/condition/greater_than.rb +15 -0
  23. data/lib/searchlogic/condition/greater_than_or_equal_to.rb +15 -0
  24. data/lib/searchlogic/condition/inclusive_descendant_of.rb +11 -0
  25. data/lib/searchlogic/condition/keywords.rb +47 -0
  26. data/lib/searchlogic/condition/less_than.rb +15 -0
  27. data/lib/searchlogic/condition/less_than_or_equal_to.rb +15 -0
  28. data/lib/searchlogic/condition/like.rb +15 -0
  29. data/lib/searchlogic/condition/nil.rb +21 -0
  30. data/lib/searchlogic/condition/not_begin_with.rb +20 -0
  31. data/lib/searchlogic/condition/not_blank.rb +19 -0
  32. data/lib/searchlogic/condition/not_end_with.rb +20 -0
  33. data/lib/searchlogic/condition/not_equal.rb +26 -0
  34. data/lib/searchlogic/condition/not_have_keywords.rb +20 -0
  35. data/lib/searchlogic/condition/not_like.rb +20 -0
  36. data/lib/searchlogic/condition/not_nil.rb +19 -0
  37. data/lib/searchlogic/condition/sibling_of.rb +14 -0
  38. data/lib/searchlogic/condition/tree.rb +17 -0
  39. data/lib/searchlogic/conditions/base.rb +484 -0
  40. data/lib/searchlogic/conditions/protection.rb +36 -0
  41. data/lib/searchlogic/config.rb +31 -0
  42. data/lib/searchlogic/config/helpers.rb +289 -0
  43. data/lib/searchlogic/config/search.rb +53 -0
  44. data/lib/searchlogic/core_ext/hash.rb +75 -0
  45. data/lib/searchlogic/helpers/control_types/link.rb +310 -0
  46. data/lib/searchlogic/helpers/control_types/links.rb +241 -0
  47. data/lib/searchlogic/helpers/control_types/remote_link.rb +87 -0
  48. data/lib/searchlogic/helpers/control_types/remote_links.rb +72 -0
  49. data/lib/searchlogic/helpers/control_types/remote_select.rb +36 -0
  50. data/lib/searchlogic/helpers/control_types/select.rb +82 -0
  51. data/lib/searchlogic/helpers/form.rb +208 -0
  52. data/lib/searchlogic/helpers/utilities.rb +197 -0
  53. data/lib/searchlogic/modifiers/absolute.rb +15 -0
  54. data/lib/searchlogic/modifiers/acos.rb +11 -0
  55. data/lib/searchlogic/modifiers/asin.rb +11 -0
  56. data/lib/searchlogic/modifiers/atan.rb +11 -0
  57. data/lib/searchlogic/modifiers/base.rb +27 -0
  58. data/lib/searchlogic/modifiers/ceil.rb +15 -0
  59. data/lib/searchlogic/modifiers/char_length.rb +15 -0
  60. data/lib/searchlogic/modifiers/cos.rb +15 -0
  61. data/lib/searchlogic/modifiers/cot.rb +15 -0
  62. data/lib/searchlogic/modifiers/day_of_month.rb +15 -0
  63. data/lib/searchlogic/modifiers/day_of_week.rb +15 -0
  64. data/lib/searchlogic/modifiers/day_of_year.rb +15 -0
  65. data/lib/searchlogic/modifiers/degrees.rb +11 -0
  66. data/lib/searchlogic/modifiers/exp.rb +15 -0
  67. data/lib/searchlogic/modifiers/floor.rb +15 -0
  68. data/lib/searchlogic/modifiers/hex.rb +11 -0
  69. data/lib/searchlogic/modifiers/hour.rb +11 -0
  70. data/lib/searchlogic/modifiers/log.rb +15 -0
  71. data/lib/searchlogic/modifiers/log10.rb +11 -0
  72. data/lib/searchlogic/modifiers/log2.rb +11 -0
  73. data/lib/searchlogic/modifiers/lower.rb +15 -0
  74. data/lib/searchlogic/modifiers/ltrim.rb +15 -0
  75. data/lib/searchlogic/modifiers/md5.rb +11 -0
  76. data/lib/searchlogic/modifiers/microseconds.rb +11 -0
  77. data/lib/searchlogic/modifiers/milliseconds.rb +11 -0
  78. data/lib/searchlogic/modifiers/minute.rb +15 -0
  79. data/lib/searchlogic/modifiers/month.rb +15 -0
  80. data/lib/searchlogic/modifiers/octal.rb +15 -0
  81. data/lib/searchlogic/modifiers/radians.rb +11 -0
  82. data/lib/searchlogic/modifiers/round.rb +11 -0
  83. data/lib/searchlogic/modifiers/rtrim.rb +15 -0
  84. data/lib/searchlogic/modifiers/second.rb +15 -0
  85. data/lib/searchlogic/modifiers/sign.rb +11 -0
  86. data/lib/searchlogic/modifiers/sin.rb +11 -0
  87. data/lib/searchlogic/modifiers/square_root.rb +15 -0
  88. data/lib/searchlogic/modifiers/tan.rb +15 -0
  89. data/lib/searchlogic/modifiers/trim.rb +15 -0
  90. data/lib/searchlogic/modifiers/upper.rb +15 -0
  91. data/lib/searchlogic/modifiers/week.rb +11 -0
  92. data/lib/searchlogic/modifiers/year.rb +11 -0
  93. data/lib/searchlogic/search/base.rb +148 -0
  94. data/lib/searchlogic/search/conditions.rb +53 -0
  95. data/lib/searchlogic/search/ordering.rb +244 -0
  96. data/lib/searchlogic/search/pagination.rb +121 -0
  97. data/lib/searchlogic/search/protection.rb +89 -0
  98. data/lib/searchlogic/search/searching.rb +31 -0
  99. data/lib/searchlogic/shared/utilities.rb +50 -0
  100. data/lib/searchlogic/shared/virtual_classes.rb +39 -0
  101. data/lib/searchlogic/version.rb +79 -0
  102. data/searchlogic.gemspec +39 -0
  103. data/test/fixtures/accounts.yml +15 -0
  104. data/test/fixtures/cats.yml +3 -0
  105. data/test/fixtures/dogs.yml +3 -0
  106. data/test/fixtures/orders.yml +14 -0
  107. data/test/fixtures/user_groups.yml +13 -0
  108. data/test/fixtures/users.yml +36 -0
  109. data/test/test_active_record_associations.rb +81 -0
  110. data/test/test_active_record_base.rb +93 -0
  111. data/test/test_condition_base.rb +52 -0
  112. data/test/test_condition_types.rb +143 -0
  113. data/test/test_conditions_base.rb +242 -0
  114. data/test/test_conditions_protection.rb +16 -0
  115. data/test/test_config.rb +23 -0
  116. data/test/test_helper.rb +134 -0
  117. data/test/test_search_base.rb +227 -0
  118. data/test/test_search_conditions.rb +19 -0
  119. data/test/test_search_ordering.rb +165 -0
  120. data/test/test_search_pagination.rb +72 -0
  121. data/test/test_search_protection.rb +24 -0
  122. data/test_libs/acts_as_tree.rb +98 -0
  123. data/test_libs/ordered_hash.rb +9 -0
  124. data/test_libs/rexml_fix.rb +14 -0
  125. metadata +317 -0
@@ -0,0 +1,197 @@
1
+ module Searchlogic
2
+ module Helpers #:nodoc:
3
+ module Utilities
4
+ # Builds a hash of params for creating a url and preserves any existing params. You can pass this into url_for and build your url. Although most rails helpers accept a hash.
5
+ #
6
+ # Let's take the page_link helper. Here is the code behind that helper:
7
+ #
8
+ # link_to("Page 2", searchlogic_params(:search_params => {:page => 2}))
9
+ #
10
+ # That's pretty much it. So if you wanted to roll your own link to execute a search, go for it. It's pretty simple. Pass conditions instead of the page, set how the search will be ordered, etc.
11
+ #
12
+ # <b>Be careful</b> when taking this approach though. Searchlogic helps you out when you use form_for. For example, when you use the per_page_select helper, it adds in a hidden form field with the value of the page. So when
13
+ # your search form is submitted it searches the document for that element, finds the current value, which is the current per_page value, and includes that in the search. So when a user searches the per_page
14
+ # value stays consistent. If you use the searchlogic_params you are on your own. I am always curious how people are using searchlogic. So if you are building your own helpers contact me and maybe I can help you
15
+ # and add in a helper for you, making it an *official* feature.
16
+ #
17
+ # === Options
18
+ # * <tt>:params_scope</tt> -- default: :search, this is the scope in which your search params will be preserved (params[:search]). If you don't want a scope and want your options to be at base leve in params such as params[:page], params[:per_page], etc, then set this to nil.
19
+ # * <tt>:search_obj</tt> -- default: @#{params_scope}, this is your search object, everything revolves around this. It will try to infer the name from your params_scope. If your params_scope is :search it will try to get @search, etc. If it can not be inferred by this, you need to pass the object itself.
20
+ # * <tt>:params</tt> -- default: nil, Additional params to add to the url, must be a hash
21
+ # * <tt>:exclude_params</tt> -- default: nil, params you want to exclude. This is nifty because it does a "deep delete". So you can pass {:param1 => {:param2 => :param3}} and it will make sure param3 does not get include. param1 and param2 will not be touched. This also accepts an array or just a symbol or string.
22
+ # * <tt>:search_params</tt> -- default: nil, Additional search params to add to the url, must be a hash. Adds the options into the :params_scope.
23
+ # * <tt>:exclude_search_params</tt> -- default: nil, Same as :exclude_params but for the :search_params.
24
+ def searchlogic_params(options = {})
25
+ add_searchlogic_defaults!(options)
26
+ options[:search_params] ||= {}
27
+ options[:literal_search_params] ||= {}
28
+
29
+ options[:params] ||= {}
30
+ params_copy = params.deep_dup.with_indifferent_access
31
+ search_params = options[:params_scope].blank? ? params_copy : params_copy.delete(options[:params_scope])
32
+ search_params ||= {}
33
+ search_params = search_params.with_indifferent_access
34
+ search_params.delete(:commit)
35
+ search_params.delete(:page)
36
+ search_params.deep_delete_duplicate_keys(options[:literal_search_params])
37
+ search_params.deep_delete(options[:exclude_search_params])
38
+
39
+ if options[:search_params]
40
+
41
+ #raise params_copy.inspect if options[:search_params][:order_by] == :id
42
+ search_params.deep_merge!(options[:search_params])
43
+
44
+ if options[:search_params][:order_by] && !options[:search_params][:order_as]
45
+ search_params[:order_as] = (searchlogic_ordering_by?(options[:search_params][:order_by], options) && options[:search_obj].asc?) ? "DESC" : "ASC"
46
+ end
47
+
48
+ [:order_by, :priority_order_by].each { |base64_field| search_params[base64_field] = searchlogic_base64_value(search_params[base64_field]) if search_params.has_key?(base64_field) }
49
+ end
50
+
51
+ new_params = params_copy
52
+ new_params.deep_merge!(options[:params])
53
+ new_params.deep_delete(options[:exclude_params])
54
+
55
+ if options[:params_scope].blank? || search_params.blank?
56
+ new_params
57
+ else
58
+ new_params.merge(options[:params_scope] => search_params)
59
+ end
60
+ end
61
+
62
+ # Similar to searchlogic_hash, but instead returns a string url. The reason this exists is to assist in creating urls in javascript. It's the muscle behind all of the select helpers that searchlogic provides.
63
+ # Take the instance where you want to do:
64
+ #
65
+ # :onchange => "window.location = '#{url_for(searchlogic_params)}&my_param=' + this.value;"
66
+ #
67
+ # Well the above obviously won't work. Do you need to apped the url with a ? or a &? What about that tricky :params_scope? That's where this is handy, beacuse it does all of the params string building for you. Check it out:
68
+ #
69
+ # :onchange => "window.location = '" + searchlogic_url(:literal_search_params => {:per_page => "' + escape(this.value) + '"}) + "';"
70
+ #
71
+ # or what about something a little more tricky?
72
+ #
73
+ # :onchange => "window.location = '" + searchlogic_url(:literal_search_params => {:conditions => {:name_contains => "' + escape(this.value) + '"}}) + "';"
74
+ #
75
+ # I have personally used this for an event calendar. Above the calendar there was a drop down for each month. Here is the code:
76
+ #
77
+ # :onchange => "window.location = '" + searchlogic_url(:literal_search_params => {:conditions => {:occurs_at_after => "' + escape(this.value) + '"}}) + "';"
78
+ #
79
+ # Now when the user changes the month in the drop down it just runs a new search that sets my conditions to occurs_at_after = selected month. Then in my controller I set occurs_at_before = occurs_at_after.at_end_of_month.
80
+ #
81
+ # === Options
82
+ # * <tt>:params_scope</tt> -- default: :search, this is the scope in which your search params will be preserved (params[:search]). If you don't want a scope and want your options to be at base leve in params such as params[:page], params[:per_page], etc, then set this to nil.
83
+ # * <tt>:search_obj</tt> -- default: @#{params_scope}, this is your search object, everything revolves around this. It will try to infer the name from your params_scope. If your params_scope is :search it will try to get @search, etc. If it can not be inferred by this, you need to pass the object itself.
84
+ # * <tt>:params</tt> -- default: nil, Additional params to add to the url, must be a hash
85
+ # * <tt>:exclude_params</tt> -- default: nil, params you want to exclude. This is nifty because it does a "deep delete". So you can pass {:param1 => {:param2 => :param3}} and it will make sure param3 does not get include. param1 and param2 will not be touched. This also accepts an array or just a symbol or string.
86
+ # * <tt>:search_params</tt> -- default: nil, Additional search params to add to the url, must be a hash. Adds the options into the :params_scope.
87
+ # * <tt>:literal_search_params</tt> -- default: nil, Additional search params to add to the url, but are not escaped. So you can add javascript into the URL: :literal_search_params => {:per_page => "' + escape(this.value) + '"}
88
+ # * <tt>:exclude_search_params</tt> -- default: nil, Same as :exclude_params but for the :search_params.
89
+ def searchlogic_url(options = {})
90
+ search_params = searchlogic_params(options)
91
+ url = url_for(search_params)
92
+ literal_param_strings = literal_param_strings(options[:literal_search_params], options[:params_scope].blank? ? "" : "#{options[:params_scope]}")
93
+ url += (url.last == "?" ? "" : (url.include?("?") ? "&amp;" : "?")) + literal_param_strings.join("&amp;")
94
+ end
95
+
96
+ # When you set up a search form using form_for for remote_form_for searchlogic adds in some *magic* for you.
97
+ #
98
+ # Take the instance where a user orders the data by something other than the default, and then does a search. The user would expect the search to remember what the user selected to order the data by, right?
99
+ # What searchlogic does is add in some hidden fields, somewhere in the page, the represent the searchlogic "state". These are automatically added for you when you use the searchlogic helpers.
100
+ # Such as: page_links, page_link, order_by_link, per_page_select, etc. So if you are using those you do not need to worry about this helper.
101
+ #
102
+ # If for some reason you do not use any of these you need to put the searchlogic state on your page somewhere. Somewhere where the state will *always* be up-to-date, which would be most likely be in the
103
+ # partial that renders your search results (assuming you are using AJAX). Otherwise when the user starts a new search, the state will be reset. Meaning the order_by, per_page, etc will all be reset.
104
+ #
105
+ # === Options
106
+ # * <tt>:params_scope</tt> -- default: :search, this is the scope in which your search params will be preserved (params[:search]). If you don't want a scope and want your options to be at base leve in params such as params[:page], params[:per_page], etc, then set this to nil.
107
+ # * <tt>:search_obj</tt> -- default: @#{params_scope}, this is your search object, everything revolves around this. It will try to infer the name from your params_scope. If your params_scope is :search it will try to get @search, etc. If it can not be inferred by this, you need to pass the object itself.
108
+ def searchlogic_state(options = {})
109
+ return "" if @added_searchlogic_state
110
+ add_searchlogic_defaults!(options)
111
+ html = ""
112
+ (Search::Base::SPECIAL_FIND_OPTIONS - [:page, :priority_order]).each do |option|
113
+ value = options[:search_obj].send(option)
114
+ html += hidden_field(options[:params_scope], option, :value => (option == :order_by ? searchlogic_base64_value(value) : value))
115
+ end
116
+ @added_searchlogic_state = true
117
+ html
118
+ end
119
+
120
+ private
121
+ # Adds default options for all helper methods.
122
+ def add_searchlogic_defaults!(options)
123
+ options[:params_scope] = :search unless options.has_key?(:params_scope)
124
+ options[:search_obj] ||= instance_variable_get("@#{options[:params_scope]}")
125
+ raise(ArgumentError, "@search object could not be inferred, please specify: :search_obj => @search or :params_scope => :search_obj_name") unless options[:search_obj].is_a?(Searchlogic::Search::Base)
126
+ options
127
+ end
128
+
129
+ # Adds default options for all control type helper methods.
130
+ def add_searchlogic_control_defaults!(options)
131
+ add_searchlogic_defaults!(options)
132
+ options[:html] ||= {}
133
+ options
134
+ end
135
+
136
+ def searchlogic_add_class!(html_options, new_class)
137
+ new_class = new_class.to_s
138
+ html_options[:class] ||= ""
139
+ classes = html_options[:class].split(" ")
140
+ classes << new_class unless classes.include?(new_class)
141
+ html_options[:class] = classes.join(" ")
142
+ end
143
+
144
+ def searchlogic_base64_value(order_by)
145
+ case order_by
146
+ when String, Symbol
147
+ order_by
148
+ when Array, Hash
149
+ [Marshal.dump(order_by)].pack("m")
150
+ end
151
+ end
152
+
153
+ def searchlogic_ordering_by?(order_by, options)
154
+ stringified_search_order_by = deep_stringify(options[:search_obj].order_by)
155
+ stringified_order_by = deep_stringify(order_by)
156
+ (options[:search_obj].order_by.blank? && options[:search_obj].klass.primary_key == stringified_order_by) || stringified_search_order_by == stringified_order_by
157
+ end
158
+
159
+ def literal_param_strings(literal_params, prefix)
160
+ param_strings = []
161
+
162
+ literal_params.each do |k, v|
163
+ param_string = prefix.blank? ? k.to_s : "#{prefix}[#{k}]"
164
+ case v
165
+ when Hash
166
+ literal_param_strings(v, param_string).each do |literal_param_string|
167
+ param_strings << literal_param_string
168
+ end
169
+ else
170
+ param_strings << (CGI.escape(param_string) + "=#{v}")
171
+ end
172
+ end
173
+
174
+ param_strings
175
+ end
176
+
177
+ def deep_stringify(obj)
178
+ case obj
179
+ when String
180
+ obj
181
+ when Symbol
182
+ obj.to_s
183
+ when Array
184
+ obj.collect { |item| deep_stringify(item) }
185
+ when Hash
186
+ new_obj = {}
187
+ obj.each { |key, value| new_obj[key.to_s] = deep_stringify(value) }
188
+ new_obj
189
+ else
190
+ obj
191
+ end
192
+ end
193
+ end
194
+ end
195
+ end
196
+
197
+ ActionController::Base.helper(Searchlogic::Helpers::Utilities) if defined?(ActionController)
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Absolute < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["abs"]
7
+ end
8
+
9
+ def return_type
10
+ :integer
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Acos < Base
4
+ class << self
5
+ def return_type
6
+ :float
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Asin < Base
4
+ class << self
5
+ def return_type
6
+ :float
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Atan < Base
4
+ class << self
5
+ def return_type
6
+ :float
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Base
4
+ class << self
5
+ # A convenience method for the name of this modifier
6
+ def modifier_name
7
+ name.split("::").last.underscore
8
+ end
9
+
10
+ # The various names for the modifier. The first in the array is the "main" name, the rest are just aliases to the "main" name
11
+ def modifier_names
12
+ [modifier_name]
13
+ end
14
+
15
+ # The method in the connection adapter that creates the SQL for the modifier
16
+ def adapter_method_name
17
+ "#{modifier_name}_sql"
18
+ end
19
+
20
+ # The type of value returned from the SQL. A class the extends this MUST define this method.
21
+ def return_type
22
+ raise "You did not specify a return type for the #{modifier_name} modifier. Please specify if it is an :integer, :string, etc."
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Ceil < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["round_up"]
7
+ end
8
+
9
+ def return_type
10
+ :integer
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class CharLength < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["length"]
7
+ end
8
+
9
+ def return_type
10
+ :integer
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Cos < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["cosine"]
7
+ end
8
+
9
+ def return_type
10
+ :float
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Cot < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["cotangent"]
7
+ end
8
+
9
+ def return_type
10
+ :float
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class DayOfMonth < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["dom"]
7
+ end
8
+
9
+ def return_type
10
+ :integer
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class DayOfWeek < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["dow"]
7
+ end
8
+
9
+ def return_type
10
+ :integer
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class DayOfYear < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["doy"]
7
+ end
8
+
9
+ def return_type
10
+ :integer
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Degrees < Base
4
+ class << self
5
+ def return_type
6
+ :float
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Exp < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["exponential"]
7
+ end
8
+
9
+ def return_type
10
+ :float
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Searchlogic
2
+ module Modifiers
3
+ class Floor < Base
4
+ class << self
5
+ def modifier_names
6
+ super + ["round_down"]
7
+ end
8
+
9
+ def return_type
10
+ :integer
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end