DigitalCommons / mykomap

A web application for mapping initiatives in the Solidarity Economy
3 stars 0 forks source link

Use localised text rather than ID when searching for a vocab field #193

Closed ColmDC closed 1 year ago

ColmDC commented 1 year ago

Describe the bug When a vocab is listed as a searched field it needs to use the localised text rather than the ID for vocab

To Reproduce Steps to reproduce the behavior: 1.Go to this test map

  1. Go to Search panel and select FOOD in the primaryActivity field.
  2. There should be about 10 matches
  3. Clear filter and then do a test search for FOOD.

Expected behavior There should be at least as many matches, but there are only 2

Video If applicable, add screenshots to help explain your problem. AwesomeScreenshot-23_03_2023,11 56 15.webm

Desktop (please complete the following information):

ColmDC commented 1 year ago

Is there still value in displaying this message, now that the filters are working? Useful for debugging, but go ugly in a porduction build.

wu-lee commented 1 year ago

Maybe not? It was always there, however, I just preserved that function. Although it looks less friendly now that we have some things to name which have no localisations - the field IDs.

Happy to remove it though, would mean one less thing to localise, I agree it's not so useful.

ColmDC commented 1 year ago

Purge!

wu-lee commented 1 year ago

Ok, removed it, and pushed the changes to testing, you should see a commit ID 1c2336e

ColmDC commented 1 year ago

So to clarify, if you use the search term AM60 it finds all the initiatives with FOOD as a Primary Activity

wu-lee commented 1 year ago

The search term AM60 comes from the drop-down selection, not the text box. But yes - if you selected the appropriate option in the primaryActivity field's dropdown. (The text which was removed showed the state of the drop-downs as well as the text field)

If you mean the text field - it might, but shouldn't. Meaning: if you search for "AM60" literally in the text field, and the searchableFields option includes primaryActivity, then this might do what you say right now. But that's a bug - it shouldn't be putting IDs into the search index.

ColmDC commented 1 year ago

The later is what I observe.

ColmDC commented 1 year ago

"getting text searches to include vocab fields: one, or a very small number of hours"

wu-lee commented 1 year ago

Ok, I think I've fixed this. I've put combinedActivities into the searchedFields list on the obo-public map, and pushed the fix to mykomap's testing branch, so if you search for "food" in the text box of the map here, it should include not just those with "food" in their descriptions or addresses, but also if it is part of the combined activity description (in English).

https://dev.maps.solidarityeconomy.coop/temp/obo-public/

The version should show as mykomap@3.0.4_ddd0fc6-modified-dev

Additionally, this is a multi-value field so it illustrates both that the text search works on vocab fields and multi-value fields: a search should match text in all of the combined activities categories included for an initiative.

ColmDC commented 1 year ago

Nice. I confirm this worked in mykomap@3.0.4_ddd0fc6-modified-dev