CMS: Adding an Index for Your Collection
2 min read
Think of your collection as a database full of information. This information is your content. In order for your content to appear on a page, the CMS (Content Management System) finds it by carrying out a database search. The more content you have, the longer it takes the CMS to find what it is looking for.
User inputs also impact database searches. A page can have a drop-down input to display a list of options from a collection. When site visitors click on the drop-down, they are searching your collection (or database).
An index (or database index) maps the structure of your data. This way, a data search has a shortcut to the information it is looking for. The data recovery is faster because it doesn't have to search the entire database every time.
If you expect your collection to contain many items, an index will reduce the time spent on data searches. This improves the end user experience.
To set up an index for your collection:
- Go to CMS in your site's dashboard.
- Click the relevant collection.
- Click More Actions.
- Click Indexes.
- Click + New Index.
- Type a name for your index in the Index Name field.
- Click the Type drop-down to select a regular or unique index:
- Regular: Create an index using up to 3 fields with a diverse range of values. Fields with a narrow range of values, like booleans, do not make good indexes. Click the Choose a field drop-down and select a field on which to base your index. Click + Add Field to add more fields.
- Unique: Create an index with fields that won't have duplicate values (e.g. ID number or email address). A unique index is limited to 1 field. Click the Choose a field drop-down and select a field on which to base your index. Learn more about unique indexes in Velo by Wix.
- Click the Sort drop-down to select Ascending or Descending for each field.
- Click Save.
Learn more about Indexes and Wix Data Collections in Velo by Wix.
Did this help?