lib/endeca/document.rb in primedia-endeca-0.9.26 vs lib/endeca/document.rb in primedia-endeca-0.10.0
- old
+ new
@@ -85,10 +85,11 @@
else
all(what)
end
end
+
# Returns the first Document matching the query options.
def self.first(query_options={})
response = request(query_options)
if response['AggrRecords']
record = response['AggrRecords'].first['Records'].first
@@ -105,22 +106,25 @@
get_collection_class.new(request(query_options), self)
end
# Returns a Document by id
def self.by_id(id, query_options={})
- first(query_options.merge(:id => id))
+ first(query_options.merge(:id => id, :skip_default_endeca_parameters => true))
end
private
def self.request(query_options)
Endeca::Request.perform(get_path, parse_query_options(query_options))
end
def self.parse_query_options(query_options)
if query_options.respond_to?(:merge)
- new_query_options = get_default_params.merge(query_options)
- query_options = transform_query_options(new_query_options)
+ unless query_options.delete(:skip_default_endeca_parameters)
+ query_options = get_default_params.merge(query_options)
+ end
+
+ transform_query_options(query_options)
else
URI.unescape(query_options)
end
end