noc.main.models.textindex

Module Contents

noc.main.models.textindex.logger
class noc.main.models.textindex.TextIndex

Bases: mongoengine.document.Document

meta
model
object
title
content
card
tags
changed
language
rx_phrases
__str__(self)
get_object(self)

Return object instance :returns: Object instance or None

classmethod on_update_model(cls, sender, instance, **kwargs)
classmethod on_delete_model(cls, sender, instance, **kwargs)
classmethod update_index(cls, sender, instance)
classmethod delete_index(cls, sender, instance)
classmethod search(cls, query, limit=1000)
Decorator to denote models supporting full text search

@full_text_search class MyModel(Model):

… def get_index(self):

return {
“id”: …, “title”: …., “content”: …., “card”: …., “tags”: …

}

@classmethod def get_search_result_url(cls, obj_id):

return “/api/card/view/mycard/%s/” % obj_id