okfn-brasil / querido-diario-api

This is Querido Diário's API. It provides everything the frontend does and even more!
https://queridodiario.ok.org.br/api/docs
MIT License
49 stars 32 forks source link

Return highlight text #25

Closed andreformento closed 3 years ago

andreformento commented 3 years ago

@jvanz @sergiomario

Prepare application

tests without territory filter

tests with territory filter

jvanz commented 3 years ago

Byu the way. Thank you for this change! This feature is really cool! :)

jvanz commented 3 years ago

Please, take a look in the make test-all

======================================================================
ERROR: test_consecutive_page_items_should_have_older_dates (tests.elasticsearch_tests.ElasticSearchDataMapperPaginationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/mnt/code/tests/elasticsearch_tests.py", line 776, in test_consecutive_page_items_should_have_older_dates
    first_page = self._mapper.get_gazettes(
  File "/mnt/code/database/elasticsearch.py", line 143, in get_gazettes
    self.create_list_with_gazette_objects(gazettes["hits"]["hits"]),
  File "/mnt/code/database/elasticsearch.py", line 120, in create_list_with_gazette_objects
    return [self._assemble_gazette_object(gazette) for gazette in gazette_hits]
  File "/mnt/code/database/elasticsearch.py", line 120, in <listcomp>
    return [self._assemble_gazette_object(gazette) for gazette in gazette_hits]
  File "/mnt/code/database/elasticsearch.py", line 114, in _assemble_gazette_object
    gazette["highlight"].get("source_text", []),
KeyError: 'highlight'

----------------------------------------------------------------------
Ran 31 tests in 55.032s

FAILED (errors=1, expected failures=1)
make: *** [Makefile:84: retest] Error 1
jvanz commented 3 years ago

FYI: make test-all runs the integration test which start an ES instance and run tests on it.