The basic search takes keywords and then runs a search which aims to produce results ranked in order of relevance. For performance, the results and manipulation are done within the database, so Kartris itself receives back a ready-sorted list of search results to display.

The stored procedure responsible is spKartrisDB_Search. It is fairly complex due to the manipulation of results it does. But the basic principle is that for any search phrase (multiple words) entered, results containing the exact phrase are scored highest. Those containing all or most of the words (though not necessarily together as an exact phrase) will come next, and those containing fewer of the words will come lower. Also, the presence of the search term or words in certain fields such as product name, will score higher than for other fields. There is also a special routine to search version codes (SKUs). Once each result is scored, a temporary table is used to sort them, highest scoring first. This methodology allows keyword-relevance-sorted results even where full-text search is not available.

Full-text search is a feature that can be enabled in MS SQL to improve the performance of searching, especially across large quantities of text. If full-text catalogs are enabled on your database, you can activate this feature in the back end of Kartris. Navigate to Configuration > Database Admin and then the FTS tab. Click the link to enable the feature, and it should confirm the various languages it is supported for.

The process of activating FTS also creates a new stored procedure - spKartrisDB_SearchFTS (and a corresponding back end one called _spKartrisDB_AdminSearchFTS). These are used in place of the normal search stored procedures on sites where FTS is enabled.

The benefits of FTS are really felt on a large site with more than 10,000 products. For sites upwards of this, FTS is almost essential as conventional searching will become slower and slower the more data there is.

Full-text search

The main search page has a secondary tab for 'advanced search'. It is somewhat of a misnomer, as the basic search is actually pretty sophisticated already. But the advanced search gives a little more control - the user can search for items between certain prices, and also specify whether they want to match the search terms to an exact phrase, to items including all keywords only, or just to items including any of the keywords.

Product attributes are additional pieces of information that are associated with a product (see 4.5. Product attributes for more information). If you want to have attributes included within the keyword search, ensure you check the 'Include in search' checkbox for the attribute in the back end. For example, a book store might have ISBN, Author and Publisher as attributes which you'd probably want to include in the search. Electrical items on the other hand might have voltage and power requirement values in numbers - you'd probably not want to include these in the search as numbers are unlikely to generate direct matches to help search results.

Powered by tomeCMS