Search
Litium uses Lucene as the underlying search engine. This article explains the general concepts and things to watch out for. Detailed code examples are given in articles under each module.
Developers are not required to know about Lucene when implementing functionality based on search, but some key observations should be kept in mind.
- When a change is made in an entity, it will take a short amount of time for the search engine to index the changes. Therefore, if you search immediately after the change, it might not result in a successful hit.
- Searching has better performance when compared to iterating through a large collection to find an item. For example, if you would like to find all articles with article numbers starting with "001", it is much faster to search.
- When building search, pay attention to the Lucene search text syntax. For example, '*' at the end of a string means a pattern match, with any number of ending characters.
- Take language into account when searching, since certain property values might be language dependent. However, if you are searching for a language independant field, you may use the default language.
- After upgrading or migrating to a new Files folder, the search indexes must be rebuilt. This can be done from Litium back office Settings > System Settings > Search Indeces.
In Litium 7 the Lucene search index can be used to search for content in the Sales, Websites and Products areas. In previous versions of Litium (5 and earlier) Lucene can be used to search for content in all areas.
Avaliable search indexes in Sales:
- ECommerceSearchDomains.Deliveries
- ECommerceSearchDomains.Orders
- ECommerceSearchDomains.Payments
Avaliable search indexes in Websites:
Avaliable search indexes in Products:
- ProductCatalogSearchDomains.Categories
- ProductCatalogSearchDomains.Products: The Products index only contains products that:
- have a valid field template
- have a valid display template
- have connected variants.
- ProductCatalogSearchDomains.ProductsAndCategories