internetarchive / internetarchive/openlibrary
JavaScript autocomplete search should perform prefix searches
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 138
Description
## Description
> What problem are we solving? What does the experience look like today? What are the symptoms?
I often can't find the book I want to add it to a reading list.
The experience of search, particularly on mobile has much room for improvement. Search results disappear as you type, and often you have to write the full book title before it appears in the results.
If the book or author name is generic, even worse you may need to result to advanced search.
The problem at least for me seems to be search defaults to "All" and does an **advanced search** rather than a prefix search and often I'm searching for either an author or book title. It seems to do a full text search but should maybe focus/prioritise title matches first e.g. prefix search.
We had similar problems on Wikpedia, but now Wikipedia does a title prefix search and usually that's exactly what you want when doing a quick look up.
## Evidence
Take a look at this search for "Tales from Earthsea". Hopefully it's clear what's wrong here - and this is on Fiber optic connection! Imagine larger lags on mobile :)

> Relevant url?
`https://openlibrary.org/...`
> Screenshot (if possible):
## Expectation
> What should by happening? What will it look like / how will it behave?
I would expect "Tales from Earthsea" to show up in results by the time I've written "Tales from" if not before. Yet it doesn't turn up when I search for "Tales from Earths"
```
fetch('https://openlibrary.org/search.json?q=Tales%20from%20Earths&limit=10&mode=ebooks' ).then((r)=>r.json()).then((r)=>console.log(r.docs.map((page)=>page.title_suggest)))
```
I would be interested in prefix and suffix matches in the JS version of search.
http://blog.florian-hopf.de/2014/03/prefix-and-suffix-matches-in-solr.html
While implementing, we should also deal with the jarring experience of hiding results in between key strokes.
## Details
> Logged in (Y/N)?
> Browser type/version?
> Operating system?
## Proposal & Constraints
> What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere?
> Which suggestions or requirements should be considered for how feature needs to appear or be implemented?
## Stakeholders
> @ tag stakeholders of this bug / feature
I can handle the frontend portion but I'll need some help with a solr expert in the team. Any volunteers?
Contributor guide
Assessment
This issue has not been assessed yet.