Skip to content

Commit e86c1fc

Browse files
committed
always trust explicitly set metadata when indexing
brand new objects may have a couchdb_id of nil, so it's not 100% reliable. use explicit metadata in this case.
1 parent 630ef03 commit e86c1fc

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎chef-solr/lib/chef/solr.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def solr_delete_by_query(queries)
115115
end
116116

117117
def rebuild_index(url=Chef::Config[:couchdb_url], db=Chef::Config[:couchdb_database])
118-
solr_delete_by_query("*:*")
118+
solr_delete_by_query("X_CHEF_database_CHEF_X:#{db}")
119119
solr_commit
120120

121121
results = {}

‎chef/lib/chef/index_queue/indexable.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def with_indexer_metadata(with_metadata={})
4949

5050
with_metadata["type"] ||= index_object_type
5151
with_metadata["database"] ||= Chef::Config[:couchdb_database]
52-
with_metadata["id"] = couchdb_id || UUIDTools::UUID.random_create.to_s
52+
with_metadata["id"] ||= (couchdb_id || UUIDTools::UUID.random_create.to_s)
5353
with_metadata["item"] = self
5454
with_metadata
5555
end

0 commit comments

Comments
 (0)