Skip to content

Commit

Permalink
Don't return font numbers in search api (#76)
Browse files Browse the repository at this point in the history
When we do a search, we also search the fonts - we use the information from
these to properly highlight the results. While this is all good, we should
not be returning these results back from the api. This patch fixes that by
returning a nil from that block, and then compacting the match array in
order to remove the nil element before returning. Fixes #63.
  • Loading branch information
ahmedre authored Aug 25, 2016
1 parent e892043 commit 840a651
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/models/search/results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ def aggregation_records
ayah_result[:ayah][:words].find{|word| word['word_id'] == id.to_i}[:highlight] = word_id_array.first
end
end
nil
else
hash
end

hash
end

ayah_result.merge!(match: match)
ayah_result.merge!(match: match.compact)

ayah_result
end
Expand Down

0 comments on commit 840a651

Please sign in to comment.