def getTermSnippets(self, term, session): es_info = self._esInfo(session['domainId']) s_fields = { "term": term, "index": es_info['activeDomainIndex'], "doc_type": es_info['docType'], } results = multifield_term_search(s_fields, 0, self._capTerms, ['tag'], self._termsIndex, 'terms', self._es) tags = results["results"] tag = [] if tags: tag = tags[0]['tag'][0].split(';') return {'term': term, 'tags': tag, 'context': get_context(term.split('_'), es_info['mapping']['text'], 500, es_info['activeDomainIndex'], es_info['docType'], self._es)}
def getTermSnippets(self, term, session): es_info = self.esInfo(session['domainId']) #tags = get_documents(term, 'term', ['tag'], es_info['activeCrawlerIndex'], 'terms', self._es) s_fields = { "term": term, "index": es_info['activeCrawlerIndex'], "doc_type": es_info['docType'], } tags = multifield_term_search(s_fields, self._capTerms, ['tag'], self._termsIndex, 'terms', self._es) tag = [] if tags: tag = tags[0]['tag'][0].split(';') return {'term': term, 'tags': tag, 'context': get_context(term.split('_'), es_info['mapping']['text'], es_info['activeCrawlerIndex'], es_info['docType'], self._es)}
def term_context(self, terms): return get_context(terms)