Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin.support.xappy.fieldactions Namespace Reference

Classes

class  SortableMarshaller
class  ActionContext
class  FieldActions

Functions

def _act_store_content
def _act_index_exact
def _act_tag
def _act_facet
def _act_index_freetext
def _act_sort_and_collapse

Variables

string __docformat__ = "restructuredtext en"

Function Documentation

def MoinMoin.support.xappy.fieldactions._act_facet (   fieldname,
  doc,
  value,
  context,
  type = None 
) [private]
Perform the FACET action.

Definition at line 53 of file fieldactions.py.

00053 
00054 def _act_facet(fieldname, doc, value, context, type=None):
00055     """Perform the FACET action.
00056     
00057     """
00058     if type is None or type == 'string':
00059         value = value.lower()
00060         doc.add_term(fieldname, value, 0)
00061         serialiser = log(xapian.StringListSerialiser,
00062                           doc.get_value(fieldname, 'facet'))
00063         serialiser.append(value)
00064         doc.add_value(fieldname, serialiser.get(), 'facet')
00065     else:
00066         marshaller = SortableMarshaller()
00067         fn = marshaller.get_marshall_function(fieldname, type)
00068         doc.add_value(fieldname, fn(fieldname, value), 'facet')

Here is the call graph for this function:

def MoinMoin.support.xappy.fieldactions._act_index_exact (   fieldname,
  doc,
  value,
  context 
) [private]
Perform the INDEX_EXACT action.

Definition at line 41 of file fieldactions.py.

00041 
00042 def _act_index_exact(fieldname, doc, value, context):
00043     """Perform the INDEX_EXACT action.
00044     
00045     """
00046     doc.add_term(fieldname, value, 0)

def MoinMoin.support.xappy.fieldactions._act_index_freetext (   fieldname,
  doc,
  value,
  context,
  weight = 1,
  language = None,
  stop = None,
  spell = False,
  nopos = False,
  allow_field_specific = True,
  search_by_default = True 
) [private]
Perform the INDEX_FREETEXT action.

Definition at line 73 of file fieldactions.py.

00073 
00074                         search_by_default=True):
00075     """Perform the INDEX_FREETEXT action.
00076     
00077     """
00078     termgen = log(xapian.TermGenerator)
00079     if language is not None:
00080         termgen.set_stemmer(log(xapian.Stem, language))
00081         
00082     if stop is not None:
00083         stopper = log(xapian.SimpleStopper)
00084         for term in stop:
00085             stopper.add (term)
00086         termgen.set_stopper (stopper)
00087 
00088     if spell:
00089         termgen.set_database(context.index)
00090         termgen.set_flags(termgen.FLAG_SPELLING)
00091     
00092     termgen.set_document(doc._doc)
00093 
00094     if search_by_default:
00095         termgen.set_termpos(context.current_position)
00096         # Store a copy of the field without a prefix, for non-field-specific
00097         # searches.
00098         if nopos:
00099             termgen.index_text_without_positions(value, weight, '')
00100         else:
00101             termgen.index_text(value, weight, '')
00102 
00103     if allow_field_specific:
00104         # Store a second copy of the term with a prefix, for field-specific
00105         # searches.
00106         prefix = doc._fieldmappings.get_prefix(fieldname)
00107         if len(prefix) != 0:
00108             termgen.set_termpos(context.current_position)
00109             if nopos:
00110                 termgen.index_text_without_positions(value, weight, prefix)
00111             else:
00112                 termgen.index_text(value, weight, prefix)
00113 
00114     # Add a gap between each field instance, so that phrase searches don't
00115     # match across instances.
00116     termgen.increase_termpos(10)
00117     context.current_position = termgen.get_termpos()

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.support.xappy.fieldactions._act_sort_and_collapse (   fieldname,
  doc,
  value,
  context,
  type = None 
) [private]
Perform the SORTABLE action.

Definition at line 178 of file fieldactions.py.

00178 
00179 def _act_sort_and_collapse(fieldname, doc, value, context, type=None):
00180     """Perform the SORTABLE action.
00181 
00182     """
00183     marshaller = SortableMarshaller()
00184     fn = marshaller.get_marshall_function(fieldname, type)
00185     value = fn(fieldname, value)
00186     doc.add_value(fieldname, value, 'collsort')

def MoinMoin.support.xappy.fieldactions._act_store_content (   fieldname,
  doc,
  value,
  context 
) [private]
Perform the STORE_CONTENT action.

Definition at line 30 of file fieldactions.py.

00030 
00031 def _act_store_content(fieldname, doc, value, context):
00032     """Perform the STORE_CONTENT action.
00033     
00034     """
00035     try:
00036         fielddata = doc.data[fieldname]
00037     except KeyError:
00038         fielddata = []
00039         doc.data[fieldname] = fielddata
00040     fielddata.append(value)

def MoinMoin.support.xappy.fieldactions._act_tag (   fieldname,
  doc,
  value,
  context 
) [private]
Perform the TAG action.

Definition at line 47 of file fieldactions.py.

00047 
00048 def _act_tag(fieldname, doc, value, context):
00049     """Perform the TAG action.
00050     
00051     """
00052     doc.add_term(fieldname, value.lower(), 0)


Variable Documentation

string MoinMoin.support.xappy.fieldactions.__docformat__ = "restructuredtext en"

Definition at line 21 of file fieldactions.py.