Details
-
Bug
-
Status: Closed (View Workflow)
-
P2
-
Resolution: Done
-
None
-
Postgres (RDS):
- t2.medium (2 vCPU, 4GB RAM)
- 1.7 Million items
With our test corpus, the "A tale of two cities" search returns 63 items.
Description
Currently, search queries occur on a continuous basis when typing in the search box. For example, as I type "A tale of two cities":
{{stripes-logger.js:27 – (action) searched for 'A'
stripes-logger.js:27 – (action) searched for 'A '
stripes-logger.js:27 – (action) searched for 'A t'
stripes-logger.js:27 – (action) searched for 'A ta'
stripes-logger.js:27 – (action) searched for 'A tal'
stripes-logger.js:27 – (action) searched for 'A tale'
stripes-logger.js:27 – (action) searched for 'A tale '
stripes-logger.js:27 – (action) searched for 'A tale o'
stripes-logger.js:27 – (action) searched for 'A tale of'
stripes-logger.js:27 – (action) searched for 'A tale of '
stripes-logger.js:27 – (action) searched for 'A tale of t'
stripes-logger.js:27 – (action) searched for 'A tale of tw'
stripes-logger.js:27 – (action) searched for 'A tale of two'
stripes-logger.js:27 – (action) searched for 'A tale of two '
stripes-logger.js:27 – (action) searched for 'A tale of two c'
stripes-logger.js:27 – (action) searched for 'A tale of two ci'
stripes-logger.js:27 – (action) searched for 'A tale of two cit'
stripes-logger.js:27 – (action) searched for 'A tale of two citi'
stripes-logger.js:27 – (action) searched for 'A tale of two citie'
stripes-logger.js:27 – (action) searched for 'A tale of two cities'}}
The result is 20 independent searches. With any significant number of items in the database this becomes increasingly slower and slower. For reference, the search takes
~5 seconds when the title is pasted in all at once. When typing it out, the final query doesn't return for ~38 seconds. Granted, the hardware being used is far from "production" quality, but these numbers are intended to show relative latencies. Presumably, we'll be able to bring those ~5 second queries down to a more reasonable duration, but the penalty incurred by the continuous search seems to place unnecessary stress on the system.
This also impacts the user experience. As the "intermediate" queries return, the search results are updated causing results to appear for a moment before being replaced. This happens repeatedly until the final query returns. Unless you're watching the console, it's hard to tell when the dust has settled and you're looking at the final results.