fpdcc / document-search

Search and management interface for spatial documents at the Forest Preserves of Cook County.
2 stars 0 forks source link

response to multiple section selections is inconsistent #77

Open glw opened 2 years ago

glw commented 2 years ago

When selecting multiple "sections" results to not match actual sections clicked.

When selecting a "section" in area 22 (RED) a section in area 23 is highlighted (result in GREEN) image

smcalilly commented 1 year ago

this happens when two sections have the same number but exist in a different area, range, or township. right now, the javascript and haystack facets don't connect a section with an area, so it'll just treat the duplicate section number as the only one.

for example, here are two tooltips for two separate sections: Image

Image

they have the same section number but are in different ranges. you can see the section in the second image isn't highlighted.

this might be a tricky bug to solve because the facets in the query string also don't have knowledge of the section/area relationship (and it looks like the query string is used to highlight the sections on the map). i don't think haystack has knowledge of this either.

there are a couple of things we need to do to fix this:

if only we could send some dictionary-like key/value pair through the query string. maybe like:

and then parse that on the backend to facet. and then when the page reloads, use the query params to highlight the correct geojson features (this page reload bit is how the js currently works).

smcalilly commented 1 year ago

@fgregg can you take a look at my above comment and let me know if you have any good ideas to solve this?

fgregg commented 1 year ago

what about simply renaming sections to be like {township}-{range}-{section}.

if we felt like the longer names messed up the UI, we could process them to only show the section bit in the ui

smcalilly commented 1 year ago

@fgregg that's a good idea. would we need to rename these sections in the database, or just rename them on the fly? i'm leaning toward the first option, which would require us to change the data in the database and then reindex, then figure out how to work with them in the searching / UI.

fgregg commented 1 year ago

yeah, it think renaming them in the db.

smcalilly commented 1 year ago

@fgregg actually, I don't think we can rename the sections like that because the sections field are an IntegerRangeField type.

Since a section can be a range of integers, I'm not sure how we can create a range of concatenated {township}-{range}-{section} sections.

There might be a way to solve all of this in the javascript logic for the map but not sure yet — I'm still figuring out the code so I'll let you know.

smcalilly commented 1 year ago

@smcalilly double check this isn't a bug with the list view.

potential solution: limit the ability to search / enforce requirements. @jim-z to think more about that.