Primary Menu

Search engine suggestions with DataparkSearch

The possibility to implement search engine suggestion has appeared in DataparkSearch Engine back in 2009. To do that a new command MakePrefixes has been implemented. This command makes automatically all prefixes for every word indexed. To enable this feature, add the following command into your configuration file:

MakePrefixes yes

Due to this feature a separate search base (which has its own DBAddr command) is required for search engine suggestions implementation. All other in configuration is standard. See an example in qsimilar.conf file in doc/samples direcory inside DataparkSearch Engine distribution.

The next step is to define the sources where the search suggestions come from. The first option is to create a special table in the SQL database which holds manually selected set of search suggestions. In the example mentioned above such table has the name "hint" with the following structure: rec_id - an unique identifier of type serial; qwords of type text; the later one contain a search suggestion on every row.

The value of section "query" is that search suggestion will be shown to a user; the value of "mode" holds the DataparkSearch mode to be used to perform this query; the "Pop_Rank" section set the priority for suggestions from this source under other equal.

The next source of search suggestions could be the query logging table "qtrack" which is filled with users query parameters if corresponding DBAddr command has the "trackquery" option specified. The obvious drawback for this source is that users can issue totally any queries and not all of them would be ethical/wise to show to other users. There is no any way to censor these records with DataparkSearch Engine. The commands for this source in qsimilar.conf are:

After you specify all of your sources of search suggestions you can run indexer to make the base ready:

./indexer -TW /usr/local/dpsearch/etc/qsimilar.conf

The AJAX technology is used to implement search suggestions on search result pages. I used to use slightly customized htmlhttprequest.js in the first version (you can still find it in doc/samples directory), but now I use YUI library from Yahoo! which is easier to use.

The first step in search template modification is to include YUI library: