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
48 stars 32 forks source link

Problema na exibição do resultado de busca | Problem displaying search result #56

Open trevineju opened 2 years ago

trevineju commented 2 years ago

Português

Ao testar o modelo de busca com prefixo da simple query string query reparei que a API nem sempre devolve excertos do trecho buscado.

Exemplo: buscando pela aparição da string **demo* (democracia, democrático, demonstração, demo**nstrativo, etc) no mês de Maio em todos os municípios, a API encontra 350 resultados. URL da requisição: https://queridodiario.ok.org.br/api/gazettes?since=2022-05-01&until=2022-05-31&querystring=demo%2A&excerpt_size=500&number_of_excerpts=1&pre_tags=&post_tags=&size=10&sort_by=relevance

A imagem exibe dois dos resultados, um deles sem excerto (o primeiro) e o outro com excerto (o segundo) image

Acredito que seja um problema apenas de exibição, já que o resultado da busca está aparentemente certo: o diário de Manaus que aparece na imagem, realmente tem ocorrências do prefixo demo em seu conteúdo. Verifiquei outros 10 diários de municípios diferentes que também não tinha o excerto sendo exibido e também eram resultados corretos de busca (tinham o prefixo no texto)

English

When testing the prefix query of [simple query string query] (https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html# simple-query-string-syntax) I noticed that the API doesn't always return excerpts from gazette searched.

Example: Looking for the appearance of the string **demo* (democracy, democratic, demonstration, demo**nstrative, etc) in the month of May in all municipalities, the API finds 350 results. Request URL: https://queridodiario.ok.org.br/api/gazettes?since=2022-05-01&until=2022-05-31&querystring=demo%2A&excerpt_size=500&number_of_excerpts=1&pre_tags=&post_tags=&size=10&sort_by=relevance

The image displays two of those results, one without an excerpt (the first) and the other with an excerpt (the second) image

I believe it is just a display problem, since the search result is apparently correct: the Manaus gazette that appears in the image actually has occurrences of the prefix demo in its content. I checked another 10 gazettes from different municipalities that also did not have the excerpt being displayed and were also correct search results (they had the prefix in the text)

trevineju commented 2 years ago

Português

Adicionalmente, o mesmo acontece utilizando o modelo de busca de distância de palavras.

A busca "decreto orçamento"~7 (que procura pelos dois termos com uma distância de até 7 palavras entre elas) também retorna resultados corretos porém sem exibir o trecho.

URL da Requisição: https://queridodiario.ok.org.br/api/gazettes?since=2022-05-01&until=2022-05-31&querystring=%22decreto%20or%C3%A7amento%22~7&excerpt_size=50&number_of_excerpts=1&pre_tags=&post_tags=&size=30&sort_by=relevance

image

English

Additionally, the same happens using the slop amount query.

The search "decreto orçamento"~7 (which searches for the two terms with a distance of up to 7 words between them) also returns correct results but without displaying the snippet.

Request URL: https://queridodiario.ok.org.br/api/gazettes?since=2022-05-01&until=2022-05-31&querystring=%22decreto%20or%C3%A7amento%22~7&excerpt_size=50&number_of_excerpts=1&pre_tags=&post_tags=&size=30&sort_by=relevance

image