Closed ghost closed 6 years ago
You can keep the index up to date via 2 methods. You can either rebuild the full index, or sync it as records are added/deleted/updated. On bigger indexes I'd recommend doing what Scout does i.e. keeping the index updated as records are changed. For smaller indexes you could rebuild it in full without issue - I have a small index of ~14k records that builds from scratch in < ~3 seconds. Technically, the correct way is Scout style imo though. For an none Laravel ecommerce site I manage I have a cron that runs every morning, that builds the index in full. If the owner wanted more flexibility (i.e. after adding a product that product is immediately searchable) I'd need to go down the scout style route.
I have a large index with 1.2 million records, with fuzzy and as you type enabled, with a search suggest feature as users type, there is a slight delay of a split second on that many records - I started to notice this after ~ 750k records. Your example of 10k records represents a very small index, I doubt you'd see any performance issues.
Note the script to update indexes is very simplistic and I doubt a large time investment would be required - see https://github.com/teamtnt/tntsearch#updating-the-index
Currently using TNTsearch in Laravel with the laravel-scout-tntsearch-driver package. TNTSearch still works without the need to sync or import the models.
Few points I would like clarified are :
Under Updating the section an example is given to update the index as you go. Instead of doing this can we run a daily index update on all our models instead (see further points below)?
How many entries / updates to the models need to occur before there is a significant lag for the fuzzy search results? ie. 1000 new entries will slow the system down significantly or 1000 new entries will make no difference, but something upward of 10,000 will.
If these examples / calculations are known it would help to know which method to choose for which project. If TNTSearch can handle up to 10,000 new entries without a performance lag, then only a daily update will be needed. If it struggles after 1,000, then I would need to write the script to add each new update to the index.
Any help would be grateful.