Back to index

moin  1.9.0~rc2
Public Member Functions | Private Attributes
MoinMoin.support.xappy.indexerconnection.SynonymIter Class Reference

List of all members.

Public Member Functions

def __init__
def __iter__
def next

Private Attributes

 _index
 _field_mappings
 _syniter

Detailed Description

Iterate through a list of synonyms.

Definition at line 754 of file indexerconnection.py.


Constructor & Destructor Documentation

def MoinMoin.support.xappy.indexerconnection.SynonymIter.__init__ (   self,
  index,
  field_mappings,
  prefix 
)
Initialise the synonym iterator.

 - `index` is the index to get the synonyms from.
 - `field_mappings` is the FieldMappings object for the iterator.
 - `prefix` is the prefix to restrict the returned synonyms to.

Definition at line 758 of file indexerconnection.py.

00758 
00759     def __init__(self, index, field_mappings, prefix):
00760         """Initialise the synonym iterator.
00761 
00762          - `index` is the index to get the synonyms from.
00763          - `field_mappings` is the FieldMappings object for the iterator.
00764          - `prefix` is the prefix to restrict the returned synonyms to.
00765 
00766         """
00767         self._index = index
00768         self._field_mappings = field_mappings
00769         self._syniter = self._index.synonym_keys(prefix)


Member Function Documentation

Definition at line 770 of file indexerconnection.py.

00770 
00771     def __iter__(self):
00772         return self

Get the next synonym.

Definition at line 773 of file indexerconnection.py.

00773 
00774     def next(self):
00775         """Get the next synonym.
00776 
00777         """
00778         synkey = self._syniter.next()
00779         pos = 0
00780         for char in synkey:
00781             if char.isupper(): pos += 1
00782             else: break
00783         if pos == 0:
00784             fieldname = None
00785             terms = synkey
00786         else:
00787             prefix = synkey[:pos]
00788             fieldname = self._field_mappings.get_fieldname_from_prefix(prefix)
00789             terms = ' '.join((term[pos:] for term in synkey.split(' ')))
00790         synval = tuple(self._index.synonyms(synkey))
00791         return ((terms, fieldname), synval)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 767 of file indexerconnection.py.

Definition at line 766 of file indexerconnection.py.

Definition at line 768 of file indexerconnection.py.


The documentation for this class was generated from the following file: