Contents
SeSQL may work with later versions of those software, but was not tested with them.
SeSQL is a standard Django application. Just drop it in the apps/ directory, and add it to enabled applications into settings.py .
Since version 0.18.0, SeSQL comes with a Django middleware. It's optional but advised to use it. The middleware will collect all indexation scheduled during a request, and perform them at the end of the request. If the same object is modified more than once in a single request, it'll therefore be reindexed only once.
To enable the middleware, add 'sesql.orm.django.middleware.UpdateQueueMiddleware' to the MIDDLEWARE_CLASSES in the Django settings.
This feature is not (yet) available using another ORM.
SeSQL needs to be able to filter out stop words from the indexed text, for performances reasons. Stop words are words like "a", "the", "is" in English, or "il", "le", "les" in French, which will occur in (almost) every text and does not carry any significant information.
PostgreSQL provides stop words files for common languages, but those files can contain accentuated characters, like "été" in French. Since SeSQL strips all accentuated characters from indexed text, they will not work directly.
You need to use one of the following three methods.
A script is now included with SeSQL, in the scripts/ directory, to automatically convert all the stop words files provided by PostgreSQL.
Please note that this script has to be executed as root, since it'll have to write in PostgreSQL data directory.
Just run, as root, scripts/generate_stop.sh. It'll ask you for the directories to handle (by default, it'll handle all standard PostgreSQL installations) and languages to handle (by default, it'll handle all of them).
Generated files will be named ascii_<language>.stop.
Alternatively, you can convert one (or more) stop words file(s) manually, with a command (as root) like (for the French language, and PostgreSQL 8.4) :
LC_ALL=fr_FR.UTF-8 iconv -f utf-8 -t ascii//TRANSLIT \ /usr/share/postgresql/8.4/tsearch_data/french.stop > \ /usr/share/postgresql/8.4/tsearch_data/ascii_french.stop
If your language isn't included, or if you want to use a custom stop words list, you can provide any text file, with a word on each line, as long as it is in the appropriate directory and doesn't contain accentuated or other kind of special characters.
Before using SeSQL you must configure it. The configuration file must be named sesql_config.py in the python path (usually the project).
For a summary of how to quickly configure SeSQL, please refer to the tutorial. This document contains a detailed list of all recognized options.
Since version 0.10, SeSQL can work with non-django ORM. See sqlalchemy.txt for more informations about it.
PostgreSQL's full text search is based on the concept of text search configuration (TSC). Those configuration are detailed on the PostgreSQL manual, and allow to control things like stopwords. SeSQL requires a default TSC, and can support additional TSCs to be used on specific indexes.
SeSQL recognizes the following options related to text search configuration :
ADDITIONAL_TS_CONFIG
This should be a list of SQL statements, to define extra TSCs that can be used in specific fields.
If set to True, all indexing will be forwarded to the daemon for asynchronous indexing. Locking will then not be used in indexation. This is recommended behavior if you have frequent changes in your database, and can tolerate a few minutes of delay between modification of the database and the results being reflected in SeSQL.
This is only supported with Django ORM for now.
If set to True (default value), then related items will be cascaded, their own related items will be reindexed, and so forth (careful, this can create loops).
If set to False, related items will only be checked for items that are explicitely indexed.
Current version of SeSQL has a few constraints :
If you need to rebuild all SeSQL indexes (because you changed them too heavily for example) you can do :
./manage.py createsesqltables | ./manage.py dbshell ./manage.py sesqlreindex