DDMAL / musiclibs

:guitar: Searching IIIF Manifests
Other
6 stars 2 forks source link

New: Auto-suggest on search input #118

Closed belljustin closed 8 years ago

belljustin commented 8 years ago

Query suggestions are added to a dropdown on the search input

belljustin commented 8 years ago
agpar commented 8 years ago

Just the last word in the query, so, remove the word 'old' here to get an example of what I meant.

"I live on s" -> I live on Sherbrooke -> I live on SunnyRoad -> I live on Saturn

agpar commented 8 years ago

I moved this on to dev. Some notes for ya:

Of these, I think only the first two are really critical. The other two are just nice (if you have the time and desire to do them).

Edits @belljustin: checkboxes ✅

agpar commented 8 years ago

I'm wondering about what the best back end suggestions could be like. The way I asked Justin to implement it, solr just suggests words based on what you've half-typed not taking the context of the other words you've typed into the field.

We could potentially do better than this. One option (which I've been exploring locally) is to copy all the labels into a suggestion field. Then, when you search for 'the psalmist', it can suggest the title of a work that contains 'the psalmist', instead of suggesting that perhaps you want 'the psalmists'.

{
    suggestions: [
        "the psalmist : a collection of psalm and hymn tunes, arranged for the organ or piano forte"
    ]
}

The problems with this is that it assumes that people will be primarily searching for labels/titles (we won't get suggestions on other fields). Also, some providers abuse the label field and put ridiculously long labels in - this would bork up the suggestions.

agpar commented 8 years ago

It's possible to have two 'active' suggestions if the mouse and keyboard are used.

Pressing enter does nothing?

agpar commented 8 years ago

Two more requests:

  1. (bug) if a user selects a suggestion and it is pasted into the search box, it will prevent any more suggestions from appearing until the field is unfocused and then refocused in on.
  2. Since we have phrase suggestion (which suggests based on titles and lables), it would be nice to have a check like:
if user_clicked_suggestion and search_results.count == 1:
    load_into_diva(search_results.docs[0])

That is, if they click a suggestion and exactly one thing comes back, load that thing.

agpar commented 8 years ago
  1. Hitting enter on a suggestion does not make the suggestion list disappear like clicking a suggestion does.
belljustin commented 8 years ago

TODO: