phetsims / paper-land

Build and explore multimodal web interactives with pieces of paper!
https://phetsims.github.io/paper-land/
MIT License
10 stars 1 forks source link

Should the title words be included when searching or filtering the file list? #43

Closed jbphet closed 1 year ago

jbphet commented 1 year ago

Under https://github.com/phetsims/papyrus/issues/36 we are adding the ability to search or filter the file list based on keywords. So far, we have talked about the keywords being explicitly specified on the 2nd line of the file. Should we include the words in the title in the list of keywords? In other words, if the first two lines of the file look like this:

// Altitude Image
// Keywords: image, model, control

...and the user entered the search term "altitude", should it match?

jbphet commented 1 year ago

@BLFiedler, @terracoda, and I discussed this briefly in a development meeting today, and we decided to include the title words for now and think on it for a bit. We could also add a checkbox with something like "Include Title", but that might clutter the UI unnecessarily.

terracoda commented 1 year ago

The filter works nice, if all related programs have a keyword in the initial program comment. I added "Ohm's Law Model" to the resistance slider and the voltage slider and now I can filter on "Ohm".

brettfiedler commented 1 year ago

Continued use has shown this is a useful feature.

We do need to change the filter to use logical AND instead of OR, so the search becomes more exclusive with additional words.

I'm not sure if that was being done as part of a separate issue. If not, let's complete it here, since it affects the title search and makes it more useful, and then close this issue. @jbphet

If that has already been done, then good to close anyway!

jbphet commented 1 year ago

I've made the filter operation a logical "AND". At first, the behavior felt a bit awkward because it was matching on whole words using the AND logic, so if I started to enter a filter string of, say, "add image", the "Add Image" program would show up after typing "add" then disappear while typing "image" until I finished typing the whole word. In an attempt to improve upon this, I changed the filtering code to allow partial matches of the most recently typed word in the filter string. This seems to work pretty nicely.

@BLFiedler - Since I ran into the complications described above, I think it would be good if you took a look at it and signed off on the behavior. If you're cool with it, feel free to close.

brettfiedler commented 1 year ago

Delayed response - sorry! this has been working great.