openlibrary
openlibrary copied to clipboard
6923/feature/implementing fuzzy search
Closes #6923
This PR implements fuzzy searching on Solr for fieldless searches, as well as for searches for the 'title', 'alternative_title', 'author', and 'text' fields. Notably, this is currently only active for work searches (and related edition queries), but it can easily be transferred to author searches, etc, if requested.
Technical
Queries of this sort will match single word terms that can be transformed into one another by up to two operations of insertion, substitution, or deletion. This sort of functionality is built into Solr, and as such, editing the way in which we write queries was the only change needed.
Unfortunately, there are some limitations to fuzzy searching; it does not function with phrases, or a series of words wrapped in quotation marks. . Fortunately, this preserves the expected functionality of many search engines, as a means of requesting only exact matches.
In order to ease editing, a new constant in the Work SearchScheme was introduced to control which fields will be fuzzy when queried.
Testing
Simply search on Solr, under the books tag. Terms without a field will be affected, as will terms related to the fields mentioned
Screenshot
Stakeholders
@cdrini