Set up product search ​

Every product listing page has a search bar. Customers search for Website Items and item groups, and can reuse their recent searches. By default, the webshop searches the database. You can use RediSearch for faster search instead.

INFO

Product search comes with the webshop app.

WARNING

RediSearch support is experimental. It needs Redis 6 or later.

Choose the searchable fields ​

  1. Open Webshop Settings, and find the item search settings.
  2. In Search Index Fields, enter the field names to search, separated by commas, for example brand. A search for "Apple" then finds the items of the brand Apple.
  3. Save.

The supported field types are Link, Table MultiSelect, Data, Small Text, and Text Editor.

Install RediSearch ​

RediSearch adds fuzzy search, autocomplete, ranking, and field indexing. Do these steps on the server, as a system administrator.

  1. Build RediSearch:

    bash
    git clone --recursive https://github.com/RediSearch/RediSearch.git
    cd RediSearch
    sudo make setup   # without sudo on macOS
    make build

    The build creates redisearch.so in the RediSearch/build directory.

  2. Move the module to /etc:

    bash
    sudo mv build/redisearch.so /etc/
  3. In the bench directory, open config/redis_cache.conf. Add this line before the save "" line:

    text
    loadmodule /etc/redisearch.so
  4. Restart the bench.

  5. Check that Redis loaded the module. Run redis-cli -p 13000 (13000 is the default cache port of a bench), then:

    text
    MODULE LIST

    The list contains search.

WARNING

The latest RediSearch needs Redis 7.1 or later, which some package repositories do not offer. Use Redis 7.1 or later with care. Learn more in the RediSearch installation guide.

Turn on RediSearch ​

  1. In Webshop Settings, select Enable Redisearch.
  2. Save.