Skip to content

Commit

Permalink
Use "unifiable" in other cases
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Dec 4, 2013
1 parent 8f4fd0b commit 2a8e52b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/droonga/plugin/distributor/search.rb
Expand Up @@ -33,7 +33,7 @@ def search(envelope)

queries.each do |name, query|
if unifiable?(name, queries) && query["output"]
query["output"]["canUnify"] = true
query["output"]["unifiable"] = true
end
end

Expand Down Expand Up @@ -74,14 +74,14 @@ def search(envelope)
final_attributes = collect_output_attributes(output["attributes"])
output["attributes"] = format_attributes_to_array_style(output["attributes"])
output["attributes"] += collect_sort_attributes(output["attributes"], query["sortBy"])
unify_by_key = output["canUnify"]
if unify_by_key && !output["attributes"].include?("_key")
unifiable = output["unifiable"]
if unifiable && !output["attributes"].include?("_key")
output["attributes"] << "_key"
end

elements[element] = sort_reducer(:attributes => output["attributes"],
:sort_keys => query["sortBy"],
:unify_by_key => unify_by_key)
:unifiable => unifiable)
# On the reducing phase, we apply only "limit". We cannot apply
# "offset" on this phase because the collecter merges a pair of
# results step by step even if there are three or more results.
Expand Down Expand Up @@ -292,7 +292,7 @@ def sort_reducer(params={})
"type" => "sort",
"operators" => operators,
}
if params[:unify_by_key] && !key_column_index.nil?
if params[:unifiable] && !key_column_index.nil?
reducer["key_column"] = key_column_index
end
reducer
Expand Down

0 comments on commit 2a8e52b

Please sign in to comment.