This plugin offers more intuitive search than Vendure's DefaultSearchPlugin before the need of an external platform like TypeSense or ElasticSearch.
This plug is meant for small to medium sized shops with up to ~10000 variants.
This plugin is not meant to be a replacement for ElasticSearch or TypeSense, but rather a lightweight alternative for small to medium sized shops. If you want to test if it works for you, give it a try and run the load tests we have included.
Features:
vendure-config.ts:betterSearch query. The very first time, this will throw an error, and it will start building the index in the background.⚠️ Set the env variable BETTER_SEARCH_INDEX_COLUMN_TYPE for your specific database! Without this, text is used as default, but this will be too small for most projects. Run a database migration after setting this env variable!
Checkout this page on more information on the different column types: https://orkhan.gitbook.io/typeorm/docs/entities#column-types-for-mysql-mariadb
You can add custom fields by defining a custom mapToSearchDocument function together with a custom indexableFields object.
For example, we have a custom field keywords on our products, and we want to index it, and return it in the search results:
Checkout the defaultSearchConfig.ts for the default weights of each field.
keywords to your products, and make the plugin index it. This is where you'd save keywords, synonyms, etc. This will drastically improve the search experience.debounceIndexRebuildMs to reduce the number of rebuilds. If that doesn't work, your dataset might be too large for this search.// TODO
max call stack exceeded errors