Commit 53acb6b7 by Oleg Marshev

Pop highlight query params.

parent c8bddd6e
...@@ -337,7 +337,7 @@ class AnnotationViewTests(BaseAnnotationViewTests): ...@@ -337,7 +337,7 @@ class AnnotationViewTests(BaseAnnotationViewTests):
results = self._get_search_results() results = self._get_search_results()
self.assertEqual(results['total'], 2) self.assertEqual(results['total'], 2)
results = self._get_search_results(text="first", highlight=True) results = self._get_search_results(text="first", highlight=True, highlight_class='class', highlight_tag='tag')
self.assertEqual(results['total'], 1) self.assertEqual(results['total'], 1)
self.assertEqual(len(results['rows']), 1) self.assertEqual(len(results['rows']), 1)
self.assertEqual(results['rows'][0]['text'], '<span>First</span> note') self.assertEqual(results['rows'][0]['text'], '<span>First</span> note')
......
...@@ -28,7 +28,11 @@ class AnnotationSearchView(APIView): ...@@ -28,7 +28,11 @@ class AnnotationSearchView(APIView):
params[field + "__match"] = params[field] params[field + "__match"] = params[field]
del params[field] del params[field]
if params.get('highlight'): if params.get('highlight'):
params.pop('highlight')
# Currently we do not use highlight_class and highlight_tag in service.
for param in ['highlight', 'highlight_class', 'highlight_tag']:
params.pop(param, None)
results = NoteMappingType.process_result( results = NoteMappingType.process_result(
list( list(
note_searcher.query(**params).order_by("-created").values_dict("_source") \ note_searcher.query(**params).order_by("-created").values_dict("_source") \
......
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