Skip to content

Comments

create autocomplete endpoint#24

Draft
andreformento wants to merge 1 commit intookfn-brasil:mainfrom
andreformento:autocomplete-endpoint
Draft

create autocomplete endpoint#24
andreformento wants to merge 1 commit intookfn-brasil:mainfrom
andreformento:autocomplete-endpoint

Conversation

@andreformento
Copy link
Collaborator

@andreformento andreformento commented Apr 21, 2021

@jvanz @sergiomario

Prepare application

  • run application
  • add more cities for manual tests:
curl -X POST 'localhost:9200/gazettes/_doc?pretty' -H 'Content-Type: application/json' -d'{
  "source_text": "This is a fake gazette content",
  "power": "executive",
  "file_checksum": "2566f0e0ff98d899ee0633da64bc65e5",
  "file_path": "3304557/2019-02-26/c942328486185aa09ec19a7c723b3a33847258ee",
  "file_url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "scraped_at": "2020-10-30T07:04:29.796347",
  "created_at": "2020-10-30T07:05:33.094289",
  "territory_id": "4202404",
  "territory_name": "Blumenau",
  "state_code": "SC",
  "edition_number": "123.45"
}'
curl -X POST 'localhost:9200/gazettes/_doc?pretty' -H 'Content-Type: application/json' -d'{
  "source_text": "tttt",
  "power": "executive",
  "file_checksum": "2566f0e0ff98d899ee0633da64bc65e5",
  "file_path": "3304557/2019-02-26/c942328486185aa09ec19a7c723b3a33847258ee",
  "file_url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "scraped_at": "2020-10-30T07:04:29.796347",
  "created_at": "2020-10-30T07:05:33.094289",
  "territory_id": "4202404",
  "territory_name": "Blumenau",
  "state_code": "SC",
  "edition_number": "541"
}'
curl -X POST 'localhost:9200/gazettes/_doc?pretty' -H 'Content-Type: application/json' -d'{
  "source_text": "adasdsad",
  "power": "executive",
  "file_checksum": "2566f0e0ff98d899ee0633da64bc65e5",
  "file_path": "3304557/2019-02-26/c942328486185aa09ec19a7c723b3a33847258ee",
  "file_url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "scraped_at": "2020-10-30T07:04:29.796347",
  "created_at": "2020-10-30T07:05:33.094289",
  "territory_id": "4302303",
  "territory_name": "Bom Jesus",
  "state_code": "RS",
  "edition_number": "541"
}'
curl -X POST 'localhost:9200/gazettes/_doc?pretty' -H 'Content-Type: application/json' -d'{
  "source_text": "aaaa",
  "power": "executive",
  "file_checksum": "2566f0e0ff98d899ee0633da64bc65e5",
  "file_path": "3304557/2019-02-26/c942328486185aa09ec19a7c723b3a33847258ee",
  "file_url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "scraped_at": "2020-10-30T07:04:29.796347",
  "created_at": "2020-10-30T07:05:33.094289",
  "territory_id": "4302303",
  "territory_name": "Bom Jesus",
  "state_code": "RS",
  "edition_number": "541"
}'
curl -X POST 'localhost:9200/gazettes/_doc?pretty' -H 'Content-Type: application/json' -d'{
  "source_text": "PB 1",
  "power": "executive",
  "file_checksum": "2566f0e0ff98d899ee0633da64bc65e5",
  "file_path": "3304557/2019-02-26/c942328486185aa09ec19a7c723b3a33847258ee",
  "file_url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "scraped_at": "2020-10-30T07:04:29.796347",
  "created_at": "2020-10-30T07:05:33.094289",
  "territory_id": "2502201",
  "territory_name": "Bom Jesus",
  "state_code": "PB",
  "edition_number": "541"
}'
curl -X POST 'localhost:9200/gazettes/_doc?pretty' -H 'Content-Type: application/json' -d'{
  "source_text": "PB 2",
  "power": "executive",
  "file_checksum": "2566f0e0ff98d899ee0633da64bc65e5",
  "file_path": "3304557/2019-02-26/c942328486185aa09ec19a7c723b3a33847258ee",
  "file_url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "url": "https://doweb.rio.rj.gov.br/portal/edicoes/download/4067",
  "scraped_at": "2020-10-30T07:04:29.796347",
  "created_at": "2020-10-30T07:05:33.094289",
  "territory_id": "2502201",
  "territory_name": "Bom Jesus",
  "state_code": "PB",
  "edition_number": "541"
}'

tests

{
    "suggestions": [
        {
            "state_code": "PB",
            "territory_id": "2502201",
            "territory_name": "Bom Jesus"
        },
        {
            "state_code": "SC",
            "territory_id": "4202404",
            "territory_name": "Blumenau"
        },
        {
            "state_code": "RS",
            "territory_id": "4302303",
            "territory_name": "Bom Jesus"
        }
    ]
}
{
    "suggestions": [
        {
            "state_code": "SC",
            "territory_id": "4202404",
            "territory_name": "Blumenau"
        }
    ]
}
  • call autocomplete with bo
  • should return 2 different cities
{
    "suggestions": [
        {
            "state_code": "PB",
            "territory_id": "2502201",
            "territory_name": "Bom Jesus"
        },
        {
            "state_code": "RS",
            "territory_id": "4302303",
            "territory_name": "Bom Jesus"
        }
    ]
}
  • call autocomplete with b with size=2
  • should return 2 different cities
{
    "suggestions": [
        {
            "state_code": "PB",
            "territory_id": "2502201",
            "territory_name": "Bom Jesus"
        },
        {
            "state_code": "SC",
            "territory_id": "4202404",
            "territory_name": "Blumenau"
        }
    ]
}

@jvanz jvanz self-requested a review April 23, 2021 20:16
Copy link
Member

@jvanz jvanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed in a previous call. We are not sure if the territory name will come from ElasticSearch index. So, for now, let keep this open until we define this.

@jvanz jvanz marked this pull request as draft May 1, 2021 23:21
@diraol diraol force-pushed the main branch 4 times, most recently from adf2084 to 8352b14 Compare January 13, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants