Package translate :: Package search :: Package indexing

[hide private]
[frames] | no frames]

# Package indexing

source code

interface for differrent indexing engines for the translate toolkit

Submodules | [hide private]

- translate.search.indexing.CommonIndexer: base class for interfaces to indexing engines for pootle
- translate.search.indexing.PyLuceneIndexer: interface for the PyLucene (v2.x) indexing engine
- translate.search.indexing.PyLuceneIndexer1: interface for the pylucene (v1.x) indexing engine
- translate.search.indexing.XapianIndexer: Interface to the Xapian indexing engine for the Translate Toolkit

Functions | [hide private]

_get_available_indexers() get a list of the available supported indexing engines | source code

list of CommonIndexer.CommonDatabase objects

_sort_indexers_by_preference(indexer_classes, pref_order) sort a given list of indexer classes according to the given order | source code

subclass of CommonIndexer.CommonDatabase

get_indexer(basedir, preference=None) return an appropriate indexer for the given directory | source code

Variables | [hide private]

| __revision__ = ``'``$Id: __init__.py 15615 2010-08-22 21:13:42Z dw``...``
| _AVAILABLE_INDEXERS = ``[`<class 'translate.search.indexing.Xapia`...``
| HAVE_INDEXER = `True`

Imports: os, shutil, logging, CommonIndexer, XapianIndexer, __init__, test_indexers

Function Details | [hide private]

### _get_available_indexers()

source code

get a list of the available supported indexing engines

search through the translate.search.indexer package for modules derived from the CommonIndexer class

### _sort_indexers_by_preference(indexer_classes, pref_order)

source code

sort a given list of indexer classes according to the given order

the list of preferred indexers are strings that should match the filenames (without suppix ".py") of the respective modules (e.g.: XapianIndexer or PyLuceneIndexer)

Parameters:
  - `indexer_classes` (list of CommonIndexer.CommonDatabase objects) - the list of all available indexer classes
  - `pref_order` (str) - list of preferred indexer names
Returns: list of CommonIndexer.CommonDatabase objects
  sorted list of indexer classes

### get_indexer(basedir, preference=None)

source code

return an appropriate indexer for the given directory

If the directory already exists, then we check, if one of the available indexers knows how to handle it. Otherwise we return the first available indexer.

Parameters:
  - `basedir` (string) - the parent directory of (possible) different indexing databases
Returns: subclass of CommonIndexer.CommonDatabase
  the class of the most appropriate indexer
Raises:
  - `IndexError` - there is no indexing engine available
  - `ValueError` - the database location already exists, but we did not find a suitable indexing engine for it
  - `OSError` - any error that could occour while creating or opening the database

Variables Details | [hide private]

### __revision__

Value:

      '$Id: __init__.py 15615 2010-08-22 21:13:42Z dwaynebailey $'

### _AVAILABLE_INDEXERS

Value:

      [<class 'translate.search.indexing.XapianIndexer.XapianDatabase'>]