Commit e71a3cbeb3b57810a836bbd4776a3c9218273fb1

Authored by Andrew
1 parent 5bf01ede

Do not raise an error when id is indexed

Showing 2 changed files with 1 additions and 5 deletions   Show diff stats
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 - Fixed `Unsupported argument type: Symbol` for async partial reindex 3 - Fixed `Unsupported argument type: Symbol` for async partial reindex
4 - Fixed infinite recursion with multi search and misspellings below 4 - Fixed infinite recursion with multi search and misspellings below
  5 +- Do not raise an error when `id` is indexed
5 6
6 ## 3.0.1 7 ## 3.0.1
7 8
lib/searchkick/record_data.rb
1 module Searchkick 1 module Searchkick
2 class RecordData 2 class RecordData
3 - EXCLUDED_ATTRIBUTES = ["id", :id]  
4 TYPE_KEYS = ["type", :type] 3 TYPE_KEYS = ["type", :type]
5 4
6 attr_reader :index, :record 5 attr_reader :index, :record
@@ -50,11 +49,7 @@ module Searchkick @@ -50,11 +49,7 @@ module Searchkick
50 def search_data(method_name = nil) 49 def search_data(method_name = nil)
51 partial_reindex = !method_name.nil? 50 partial_reindex = !method_name.nil?
52 51
53 - # remove _id since search_id is used instead  
54 source = record.send(method_name || :search_data) 52 source = record.send(method_name || :search_data)
55 - EXCLUDED_ATTRIBUTES.each do |attr|  
56 - raise Searchkick::Error, "Cannot index a field with name: #{attr}" if source[attr]  
57 - end  
58 53
59 # conversions 54 # conversions
60 index.conversions_fields.each do |conversions_field| 55 index.conversions_fields.each do |conversions_field|