Added branch 1.0.
[wolnelektury.git] / apps / djangosphinx / __init__.py
1 """
2 Sphinx Search Engine ORM for Django models
3 http://www.sphinxsearch.com/
4 Developed and maintained David Cramer <dcramer@gmail.com>
5
6 To add a search manager to your model:
7 <code>
8     search = SphinxSearch([index=<string>, weight=[<int>,], mode=<string>])
9 </code>
10
11 To query the engine and retrieve objects:
12 <code>
13     MyModel.search.query('my string')
14 </code>
15
16 To use multiple index support, you need to define a "content_type" field in your SQL
17 clause. Each index also needs to have the exact same field's. The rules are almost identical
18 to that of an SQL UNION query.
19 <code>
20     SELECT id, name, 1 as content_type FROM model_myapp
21     SELECT id, name, 2 as content_type FROM model_myotherapp
22     search_results = SphinxSearch()
23     search_results.on_index('model_myapp model_myotherapp')
24     search_results.query('hello')
25 </code>
26
27 default settings.py values
28 <code>
29     SPHINX_SERVER = 'localhost'
30     SPHINX_PORT = 3312
31 </code>
32 """
33
34 from manager import SearchError, ConnectionError, SphinxSearch
35 from utils import generate_config_for_model, generate_config_for_models