Klimatbyran / beta

New repo for new layout
2 stars 3 forks source link

[BUG] Companies dropdown shows duplicates #154

Open LudwikJaniuk opened 1 week ago

LudwikJaniuk commented 1 week ago

E:g. for "JM" or "OX2" there are two entries, one with Q-identifier and one without.

Greenheart commented 1 week ago

Thanks! This is a known bug caused by the API returning duplicates. We previously had naive filtering on the frontend, but it caused other problems. The real solution is to improve how we fetch companies from OpenSearch (which are then returned by the API). Relevant code (an OpenSearch query): https://github.com/Klimatbyran/garbo/blob/2adf04f9ce7b2d59d41b4ac62ceea372e85d7b48/src/opensearch.ts#L257

LudwikJaniuk commented 1 week ago

Thanks for the link. That seems more or less fine, only modification I see would be to require the wikidata id to be nonempty in the query. Would that be useful?

The fundamental problem of indexing on wikidata ids is discussed in https://github.com/Klimatbyran/beta/issues/155

LudwikJaniuk commented 1 week ago

These two examples are solved but the base problem should still be adressed.