Skip to content
This repository has been archived by the owner on Aug 8, 2019. It is now read-only.

Commit

Permalink
make more tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
highbeats committed May 12, 2014
1 parent 5dceca3 commit 2120198
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/tirexs/query.ex
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,16 @@ defmodule Tirexs.Query do
{ url, json } = { "#{url}/_search" <> to_param(opts, ""), to_resource_json(definition) }
case Tirexs.ElasticSearch.post(url, json, settings) do
{:ok, _, result} ->
count = result["hits"]["total"]
hits = result["hits"]["hits"]
facets = result["facets"]
max_score = result["hits"]["max_score"]
scroll_id = result["_scroll_id"]
count = result[:hits][:total]
hits = result[:hits][:hits]
facets = result[:facets]
max_score = result[:hits][:max_score]
scroll_id = result[:_scroll_id]
Result.new(count: count, hits: hits, facets: facets, max_score: max_score, _scroll_id: scroll_id)
result -> result
end
end

@doc false
def to_resource_json(definition), do: JSEX.encode!(definition[:search])
end
end
2 changes: 1 addition & 1 deletion test/acceptances/elastic_search_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ defmodule Acceptances.ElasticSearchTest do
result = Tirexs.Query.create_resource(s, settings)

assert result.count == 1
assert List.first(result.hits)["_source"]["id"] == 2
assert List.first(result.hits)[:_source][:id] == 2

end
end

0 comments on commit 2120198

Please sign in to comment.