translate.search.indexing.XapianIndexer

Package translate :: Package search :: Package indexing :: Module XapianIndexer |
[hide private]
[frames] | no frames]

# Module XapianIndexer

source code

Interface to the Xapian indexing engine for the Translate Toolkit

Xapian v1.0 or higher is supported.

If you are interested in writing an interface for Xapian 0.x, then you should checkout the following:

       svn export -r 7235 https://translate.svn.sourceforge.net/svnroot/translate/src/branches/translate-search-indexer-generic-merging/translate/search/indexer/

It is not completely working, but it should give you a good start.

Classes | [hide private]
| XapianDatabase interface to the xapian (http://xapian.org) indexer
| XapianEnquire interface to the xapian object for storing sets of matches

Functions | [hide private]
_str2version(version) | source code
is_available() | source code
str |
_truncate_term_length(term, taken=0) truncate the length of a term string length to the maximum allowed for xapian terms | source code
_extract_fieldvalues(match, (result, fieldnames)) add a dict of field values to a list | source code

Variables | [hide private]
| __revision__ = ``'``$Id: XapianIndexer.py 17248 2011-01-31 16:35:1``...``
| command = `subprocess.Popen(['xapian-check', '--version'], stdo`...``
| _MAX_TERM_LENGTH = `128`
| __package__ = ``'``translate.search.indexing``'``

Imports: sys, re, subprocess, CommonIndexer, xapian, os, time, logging

Function Details | [hide private]

### _truncate_term_length(term, taken=0) | source code
truncate the length of a term string length to the maximum allowed for xapian terms Parameters: `term` (str) - the value of the term, that should be truncated `taken` (int) - since a term consists of the name of the term and its actual value, this additional parameter can be used to reduce the maximum count of possible characters Returns: str the truncated string

### _extract_fieldvalues(match, (result, fieldnames)) | source code
add a dict of field values to a list usually this function should be used together with '_walk_matches' for traversing a list of matches Parameters: `match` (xapian.MSet) - a single match object `result` (list of dict) - the resulting dict will be added to this list `fieldnames` (list of str) - the names of the fields to be added to the dict

Variables Details | [hide private]

  ### __revision__ Value:
      '$Id: XapianIndexer.py 17248 2011-01-31 16:35:12Z friedelwolff $'

  ### command Value:
      subprocess.Popen(['xapian-check', '--version'], stdout= subprocess.PIP
      E)