Commit 10aabf6a authored by Katia Saurfelt's avatar Katia Saurfelt
Browse files

[index] make adapter a class variable to ease overwriting

parent 7cd0a3525b6f
......@@ -50,6 +50,7 @@ class EsRegistry(AppObject):
class Indexer(EsRegistry):
__regid__ = 'indexer'
adapter = 'IFullTextIndexSerializable'
settings = {
'settings': {
'analysis': {
......@@ -93,7 +94,7 @@ class Indexer(EsRegistry):
if es_cnx is None or not self.index_name:
self.error('no connection to ES (not configured) skip ES indexing')
return
serializable = entity.cw_adapt_to('IFullTextIndexSerializable')
serializable = entity.cw_adapt_to(self.adapter)
json = serializable.serialize()
if not json:
return
......@@ -106,7 +107,7 @@ class Indexer(EsRegistry):
if es_cnx is None or not self.index_name:
self.error('no connection to ES (not configured) skip ES deletion')
return
serializable = entity.cw_adapt_to('IFullTextIndexSerializable')
serializable = entity.cw_adapt_to(self.adapter)
es_cnx.delete(index=self.index_name, id=serializable.es_id,
doc_type=serializable.es_doc_type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment