Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Member Functions
MoinMoin.search.Xapian.indexing.XapianIndex Class Reference
Inheritance diagram for MoinMoin.search.Xapian.indexing.XapianIndex:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.search.Xapian.indexing.XapianIndex:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def exists
def mtime
def touch
def get_search_connection
def get_indexer_connection
def do_queued_updates
def search
def update_item
def indexPages
def optimize
def contentfilter

Public Attributes

 db
 request
 main_dir
 update_queue

Private Member Functions

def _main_dir
def _search
def _get_document
def _add_fields_to_document
def _get_languages
def _get_categories
def _get_domains
def _index_page
def _index_page_rev
def _remove_page_rev
def _index_attachment
def _index_file
def _index_pages

Detailed Description

Definition at line 120 of file indexing.py.


Constructor & Destructor Documentation

def MoinMoin.search.Xapian.indexing.XapianIndex.__init__ (   self,
  request,
  name = 'index' 
)

Definition at line 122 of file indexing.py.

00122 
00123     def __init__(self, request, name='index'):
00124         super(XapianIndex, self).__init__(request)
00125         self.db = os.path.join(self.main_dir, name)


Member Function Documentation

def MoinMoin.search.Xapian.indexing.XapianIndex._add_fields_to_document (   self,
  request,
  document,
  fields = None,
  multivalued_fields = None 
) [private]

Definition at line 250 of file indexing.py.

00250 
00251     def _add_fields_to_document(self, request, document, fields=None, multivalued_fields=None):
00252 
00253         fields_to_stem = ['title', 'content']
00254 
00255         if fields is None:
00256             fields = {}
00257         if multivalued_fields is None:
00258             multivalued_fields = {}
00259 
00260         for field, value in fields.iteritems():
00261             document.fields.append(xappy.Field(field, value))
00262             if field in fields_to_stem:
00263                 document.fields.append(StemmedField(field, value, request))
00264 
00265         for field, values in multivalued_fields.iteritems():
00266             for value in values:
00267                 document.fields.append(xappy.Field(field, value))

Here is the caller graph for this function:

Get all categories the page belongs to through the old regular expression

@param page: the page instance

Definition at line 294 of file indexing.py.

00294 
00295     def _get_categories(self, page):
00296         """ Get all categories the page belongs to through the old regular expression
00297 
00298         @param page: the page instance
00299         """
00300         body = page.get_raw_body()
00301 
00302         prev, next = (0, 1)
00303         pos = 0
00304         while next:
00305             if next != 1:
00306                 pos += next.end()
00307             prev, next = next, re.search(r'-----*\s*\r?\n', body[pos:])
00308 
00309         if not prev or prev == 1:
00310             return []
00311         # for CategoryFoo, group 'all' matched CategoryFoo, group 'key' matched just Foo
00312         return [m.group('all') for m in self.request.cfg.cache.page_category_regex.finditer(body[pos:])]

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._get_document (   self,
  connection,
  doc_id,
  mtime,
  mode 
) [private]

Definition at line 227 of file indexing.py.

00227 
00228     def _get_document(self, connection, doc_id, mtime, mode):
00229         do_index = False
00230 
00231         if mode == 'update':
00232             try:
00233                 doc = connection.get_document(doc_id)
00234                 docmtime = long(doc.data['mtime'][0])
00235             except KeyError:
00236                 do_index = True
00237             else:
00238                 do_index = mtime > docmtime
00239         elif mode == 'add':
00240             do_index = True
00241         else:
00242             raise ValueError("mode must be 'update' or 'add'")
00243 
00244         if do_index:
00245             document = xappy.UnprocessedDocument()
00246             document.id = doc_id
00247         else:
00248             document = None
00249         return document

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._get_domains (   self,
  page 
) [private]
Returns a generator with all the domains the page belongs to

@param page: page

Definition at line 313 of file indexing.py.

00313 
00314     def _get_domains(self, page):
00315         """ Returns a generator with all the domains the page belongs to
00316 
00317         @param page: page
00318         """
00319         if page.isUnderlayPage():
00320             yield 'underlay'
00321         if page.isStandardPage():
00322             yield 'standard'
00323         if wikiutil.isSystemPage(self.request, page.page_name):
00324             yield 'system'

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._get_languages (   self,
  page 
) [private]
Get language of a page and the language to stem it in

@param page: the page instance

Definition at line 268 of file indexing.py.

00268 
00269     def _get_languages(self, page):
00270         """ Get language of a page and the language to stem it in
00271 
00272         @param page: the page instance
00273         """
00274         lang = None
00275         default_lang = page.request.cfg.language_default
00276 
00277         # if we should stem, we check if we have a stemmer for the language available
00278         if page.request.cfg.xapian_stemming:
00279             lang = page.pi['language']
00280             try:
00281                 xapian.Stem(lang)
00282                 # if there is no exception, lang is stemmable
00283                 return (lang, lang)
00284             except xapian.InvalidArgumentError:
00285                 # lang is not stemmable
00286                 pass
00287 
00288         if not lang:
00289             # no lang found at all.. fallback to default language
00290             lang = default_lang
00291 
00292         # return actual lang and lang to stem in
00293         return (lang, default_lang)

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._index_attachment (   self,
  request,
  connection,
  pagename,
  attachmentname,
  mode = 'update' 
) [private]
Index an attachment

@param request: request suitable for indexing
@param connection: the Indexer connection object
@param pagename: the page name
@param attachmentname: the attachment's name
@param mode: 'add' = just add, no checks
     'update' = check if already in index and update if needed (mtime)

Definition at line 444 of file indexing.py.

00444 
00445     def _index_attachment(self, request, connection, pagename, attachmentname, mode='update'):
00446         """ Index an attachment
00447 
00448         @param request: request suitable for indexing
00449         @param connection: the Indexer connection object
00450         @param pagename: the page name
00451         @param attachmentname: the attachment's name
00452         @param mode: 'add' = just add, no checks
00453                      'update' = check if already in index and update if needed (mtime)
00454         """
00455         from MoinMoin.action import AttachFile
00456         wikiname = request.cfg.interwikiname or u"Self"
00457         itemid = "%s:%s//%s" % (wikiname, pagename, attachmentname)
00458 
00459         filename = AttachFile.getFilename(request, pagename, attachmentname)
00460         # check if the file is still there. as we might be doing queued index updates,
00461         # the file could be gone meanwhile...
00462         if os.path.exists(filename):
00463             mtime = wikiutil.timestamp2version(os.path.getmtime(filename))
00464             doc = self._get_document(connection, itemid, mtime, mode)
00465             logging.debug("%s %s %r" % (pagename, attachmentname, doc))
00466             if doc:
00467                 page = Page(request, pagename)
00468                 mimetype, att_content = self.contentfilter(filename)
00469 
00470                 fields = {}
00471                 fields['wikiname'] = wikiname
00472                 fields['pagename'] = pagename
00473                 fields['attachment'] = attachmentname
00474                 fields['mtime'] = str(mtime)
00475                 fields['revision'] = '0'
00476                 fields['title'] = '%s/%s' % (pagename, attachmentname)
00477                 fields['content'] = att_content
00478                 fields['lang'], fields['stem_lang'] = self._get_languages(page)
00479 
00480                 multivalued_fields = {}
00481                 multivalued_fields['mimetype'] = [mt for mt in [mimetype] + mimetype.split('/')]
00482                 multivalued_fields['domain'] = self._get_domains(page)
00483 
00484                 self._add_fields_to_document(request, doc, fields, multivalued_fields)
00485 
00486                 connection.replace(doc)
00487                 logging.debug('attachment %s (page %s) updated in index' % (attachmentname, pagename))
00488         else:
00489             # attachment file was deleted, remove it from index also
00490             connection.delete(itemid)
00491             logging.debug('attachment %s (page %s) removed from index' % (attachmentname, pagename))

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._index_file (   self,
  request,
  connection,
  filename,
  mode = 'update' 
) [private]
index files (that are NOT attachments, just arbitrary files)

@param request: request suitable for indexing
@param connection: the Indexer connection object
@param filename: a filesystem file name
@param mode: 'add' = just add, no checks
     'update' = check if already in index and update if needed (mtime)

Definition at line 492 of file indexing.py.

00492 
00493     def _index_file(self, request, connection, filename, mode='update'):
00494         """ index files (that are NOT attachments, just arbitrary files)
00495 
00496         @param request: request suitable for indexing
00497         @param connection: the Indexer connection object
00498         @param filename: a filesystem file name
00499         @param mode: 'add' = just add, no checks
00500                      'update' = check if already in index and update if needed (mtime)
00501         """
00502         wikiname = request.cfg.interwikiname or u"Self"
00503         fs_rootpage = 'FS' # XXX FS hardcoded
00504 
00505         try:
00506             itemid = "%s:%s" % (wikiname, os.path.join(fs_rootpage, filename))
00507             mtime = wikiutil.timestamp2version(os.path.getmtime(filename))
00508 
00509             doc = self._get_document(connection, itemid, mtime, mode)
00510             logging.debug("%s %r" % (filename, doc))
00511             if doc:
00512                 mimetype, file_content = self.contentfilter(filename)
00513 
00514                 fields = {}
00515                 fields['wikiname'] = wikiname
00516                 fields['pagename'] = fs_rootpage
00517                 fields['attachment'] = filename # XXX we should treat files like real pages, not attachments
00518                 fields['mtime'] = str(mtime)
00519                 fields['revision'] = '0'
00520                 fields['title'] = " ".join(os.path.join(fs_rootpage, filename).split("/"))
00521                 fields['content'] = file_content
00522 
00523                 multivalued_fields = {}
00524                 multivalued_fields['mimetype'] = [mt for mt in [mimetype] + mimetype.split('/')]
00525 
00526                 self._add_fields_to_document(request, doc, fields, multivalued_fields)
00527 
00528                 connection.replace(doc)
00529 
00530         except (OSError, IOError, UnicodeError):
00531             logging.exception("_index_file crashed:")

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._index_page (   self,
  request,
  connection,
  pagename,
  mode = 'update' 
) [private]
Index a page.

Index all revisions (if wanted by configuration) and all attachments.

@param request: request suitable for indexing
@param connection: the Indexer connection object
@param pagename: a page name
@param mode: 'add' = just add, no checks
     'update' = check if already in index and update if needed (mtime)

Definition at line 325 of file indexing.py.

00325 
00326     def _index_page(self, request, connection, pagename, mode='update'):
00327         """ Index a page.
00328 
00329         Index all revisions (if wanted by configuration) and all attachments.
00330 
00331         @param request: request suitable for indexing
00332         @param connection: the Indexer connection object
00333         @param pagename: a page name
00334         @param mode: 'add' = just add, no checks
00335                      'update' = check if already in index and update if needed (mtime)
00336         """
00337         page = Page(request, pagename)
00338         revlist = page.getRevList() # recent revs first, does not include deleted revs
00339         logging.debug("indexing page %r, %d revs found" % (pagename, len(revlist)))
00340 
00341         if not revlist:
00342             # we have an empty revision list, that means the page is not there any more,
00343             # likely it (== all of its revisions, all of its attachments) got either renamed or nuked
00344             wikiname = request.cfg.interwikiname or u'Self'
00345 
00346             sc = self.get_search_connection()
00347             docs_to_delete = sc.get_all_documents_with_fields(wikiname=wikiname, pagename=pagename)
00348                                                               # any page rev, any attachment
00349             sc.close()
00350 
00351             for doc in docs_to_delete:
00352                 connection.delete(doc.id)
00353             logging.debug('page %s (all revs, all attachments) removed from xapian index' % pagename)
00354 
00355         else:
00356             if request.cfg.xapian_index_history:
00357                 index_revs, remove_revs = revlist, []
00358             else:
00359                 if page.exists(): # is current rev not deleted?
00360                     index_revs, remove_revs = revlist[:1], revlist[1:]
00361                 else:
00362                     index_revs, remove_revs = [], revlist
00363 
00364             for revno in index_revs:
00365                 updated = self._index_page_rev(request, connection, pagename, revno, mode=mode)
00366                 logging.debug("updated page %r rev %d (updated==%r)" % (pagename, revno, updated))
00367                 if not updated:
00368                     # we reached the revisions that are already present in the index
00369                     break
00370 
00371             for revno in remove_revs:
00372                 # XXX remove_revs can be rather long for pages with many revs and
00373                 # XXX most page revs usually will be already deleted. optimize?
00374                 self._remove_page_rev(request, connection, pagename, revno)
00375                 logging.debug("removed page %r rev %d" % (pagename, revno))
00376 
00377             from MoinMoin.action import AttachFile
00378             for attachmentname in AttachFile._get_files(request, pagename):
00379                 self._index_attachment(request, connection, pagename, attachmentname, mode)

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._index_page_rev (   self,
  request,
  connection,
  pagename,
  revno,
  mode = 'update' 
) [private]
Index a page revision.

@param request: request suitable for indexing
@param connection: the Indexer connection object
@param pagename: the page name
@param revno: page revision number (int)
@param mode: 'add' = just add, no checks
     'update' = check if already in index and update if needed (mtime)

Definition at line 380 of file indexing.py.

00380 
00381     def _index_page_rev(self, request, connection, pagename, revno, mode='update'):
00382         """ Index a page revision.
00383 
00384         @param request: request suitable for indexing
00385         @param connection: the Indexer connection object
00386         @param pagename: the page name
00387         @param revno: page revision number (int)
00388         @param mode: 'add' = just add, no checks
00389                      'update' = check if already in index and update if needed (mtime)
00390         """
00391         page = Page(request, pagename, rev=revno)
00392         request.page = page # XXX for what is this needed?
00393 
00394         wikiname = request.cfg.interwikiname or u"Self"
00395         revision = str(page.get_real_rev())
00396         itemid = "%s:%s:%s" % (wikiname, pagename, revision)
00397         mtime = page.mtime_usecs()
00398 
00399         doc = self._get_document(connection, itemid, mtime, mode)
00400         logging.debug("%s %s %r" % (pagename, revision, doc))
00401         if doc:
00402             mimetype = 'text/%s' % page.pi['format']  # XXX improve this
00403 
00404             fields = {}
00405             fields['wikiname'] = wikiname
00406             fields['pagename'] = pagename
00407             fields['attachment'] = '' # this is a real page, not an attachment
00408             fields['mtime'] = str(mtime)
00409             fields['revision'] = revision
00410             fields['title'] = pagename
00411             fields['content'] = page.get_raw_body()
00412             fields['lang'], fields['stem_lang'] = self._get_languages(page)
00413             fields['author'] = page.edit_info().get('editor', '?')
00414 
00415             multivalued_fields = {}
00416             multivalued_fields['mimetype'] = [mt for mt in [mimetype] + mimetype.split('/')]
00417             multivalued_fields['domain'] = self._get_domains(page)
00418             multivalued_fields['linkto'] = page.getPageLinks(request)
00419             multivalued_fields['category'] = self._get_categories(page)
00420 
00421             self._add_fields_to_document(request, doc, fields, multivalued_fields)
00422 
00423             try:
00424                 connection.replace(doc)
00425             except xappy.IndexerError, err:
00426                 logging.warning("IndexerError at %r %r %r (%s)" % (
00427                     wikiname, pagename, revision, str(err)))
00428 
00429         return bool(doc)

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._index_pages (   self,
  request,
  files = None,
  mode = 'update',
  pages = None 
) [private]
Index all (given) pages (and all given files)

This should be called from indexPages only!

@param request: request suitable for indexing
@param files: an optional list of files to index
@param mode: 'add' = just add, no checks
     'update' = check if already in index and update if needed (mtime)
@param pages: list of pages to index, if not given, all pages are indexed

Reimplemented from MoinMoin.search.builtin.BaseIndex.

Definition at line 532 of file indexing.py.

00532 
00533     def _index_pages(self, request, files=None, mode='update', pages=None):
00534         """ Index all (given) pages (and all given files)
00535 
00536         This should be called from indexPages only!
00537 
00538         @param request: request suitable for indexing
00539         @param files: an optional list of files to index
00540         @param mode: 'add' = just add, no checks
00541                      'update' = check if already in index and update if needed (mtime)
00542         @param pages: list of pages to index, if not given, all pages are indexed
00543         """
00544         if pages is None:
00545             # Index all pages
00546             pages = request.rootpage.getPageList(user='', exists=1)
00547 
00548         try:
00549             connection = self.get_indexer_connection()
00550             self.touch()
00551             try:
00552                 logging.info("indexing %d pages..." % len(pages))
00553                 for pagename in pages:
00554                     self._index_page(request, connection, pagename, mode=mode)
00555                 if files:
00556                     logging.info("indexing all files...")
00557                     for fname in files:
00558                         fname = fname.strip()
00559                         self._index_file(request, connection, fname, mode)
00560             finally:
00561                 connection.close()
00562         except XapianDatabaseLockError:
00563             logging.warning("xapian index is locked, can't index.")
00564 

Here is the call graph for this function:

Get the directory of the xapian index 

Reimplemented from MoinMoin.search.builtin.BaseIndex.

Definition at line 126 of file indexing.py.

00126 
00127     def _main_dir(self):
00128         """ Get the directory of the xapian index """
00129         if self.request.cfg.xapian_index_dir:
00130             return os.path.join(self.request.cfg.xapian_index_dir,
00131                     self.request.cfg.siteid)
00132         else:
00133             return os.path.join(self.request.cfg.cache_dir, 'xapian')

def MoinMoin.search.Xapian.indexing.XapianIndex._remove_page_rev (   self,
  request,
  connection,
  pagename,
  revno 
) [private]
Remove a page revision from the index.

@param request: request suitable for indexing
@param connection: the Indexer connection object
@param pagename: the page name
@param revno: a real revision number (int), > 0

Definition at line 430 of file indexing.py.

00430 
00431     def _remove_page_rev(self, request, connection, pagename, revno):
00432         """ Remove a page revision from the index.
00433 
00434         @param request: request suitable for indexing
00435         @param connection: the Indexer connection object
00436         @param pagename: the page name
00437         @param revno: a real revision number (int), > 0
00438         """
00439         wikiname = request.cfg.interwikiname or u"Self"
00440         revision = str(revno)
00441         itemid = "%s:%s:%s" % (wikiname, pagename, revision)
00442         connection.delete(itemid)
00443         logging.debug('page %s, revision %d removed from index' % (pagename, revno))

Here is the caller graph for this function:

def MoinMoin.search.Xapian.indexing.XapianIndex._search (   self,
  query,
  sort = 'weight',
  historysearch = 0 
) [private]
Perform the search using xapian

@param query: the search query objects
@param sort: the sorting of the results (default: 'weight')
@param historysearch: whether to search in all page revisions (default: 0) TODO: use/implement this

Definition at line 152 of file indexing.py.

00152 
00153     def _search(self, query, sort='weight', historysearch=0):
00154         """
00155         Perform the search using xapian
00156 
00157         @param query: the search query objects
00158         @param sort: the sorting of the results (default: 'weight')
00159         @param historysearch: whether to search in all page revisions (default: 0) TODO: use/implement this
00160         """
00161         while True:
00162             try:
00163                 searcher, timestamp = self.request.cfg.xapian_searchers.pop()
00164                 if timestamp != self.mtime():
00165                     searcher.close()
00166                 else:
00167                     break
00168             except IndexError:
00169                 searcher = self.get_search_connection()
00170                 timestamp = self.mtime()
00171                 break
00172 
00173         # Refresh connection, since it may be outdated.
00174         searcher.reopen()
00175         query = query.xapian_term(self.request, searcher)
00176 
00177         # Get maximum possible amount of hits from xappy, which is number of documents in the index.
00178         document_count = searcher.get_doccount()
00179 
00180         kw = {}
00181         if sort == 'page_name':
00182             kw['sortby'] = 'pagename'
00183 
00184         hits = searcher.search(query, 0, document_count, **kw)
00185 
00186         self.request.cfg.xapian_searchers.append((searcher, timestamp))
00187         return hits

Here is the call graph for this function:

def MoinMoin.search.builtin.BaseIndex.contentfilter (   self,
  filename 
) [inherited]
Get a filter for content of filename and return unicode content.

@param filename: name of the file

Definition at line 187 of file builtin.py.

00187 
00188     def contentfilter(self, filename):
00189         """ Get a filter for content of filename and return unicode content.
00190 
00191         @param filename: name of the file
00192         """
00193         request = self.request
00194         mt = wikiutil.MimeType(filename=filename)
00195         for modulename in mt.module_name():
00196             try:
00197                 execute = wikiutil.importPlugin(request.cfg, 'filter', modulename)
00198                 break
00199             except wikiutil.PluginMissingError:
00200                 pass
00201             else:
00202                 logging.info("Cannot load filter for mimetype %s" % modulename)
00203         try:
00204             data = execute(self, filename)
00205             logging.debug("Filter %s returned %d characters for file %s" % (modulename, len(data), filename))
00206         except (OSError, IOError), err:
00207             data = ''
00208             logging.warning("Filter %s threw error '%s' for file %s" % (modulename, str(err), filename))
00209         return mt.mime_type(), data

Here is the caller graph for this function:

Index <amount> entries from the indexer queue.

    @param amount: amount of queue entries to process (default: -1 == all)

Reimplemented from MoinMoin.search.builtin.BaseIndex.

Definition at line 188 of file indexing.py.

00188 
00189     def do_queued_updates(self, amount=-1):
00190         """ Index <amount> entries from the indexer queue.
00191 
00192             @param amount: amount of queue entries to process (default: -1 == all)
00193         """
00194         try:
00195             request = self._indexingRequest(self.request)
00196             connection = self.get_indexer_connection()
00197             self.touch()
00198             try:
00199                 done_count = 0
00200                 while amount:
00201                     # trick: if amount starts from -1, it will never get 0
00202                     amount -= 1
00203                     try:
00204                         pagename, attachmentname, revno = self.update_queue.get()
00205                     except IndexError:
00206                         # queue empty
00207                         break
00208                     else:
00209                         logging.debug("got from indexer queue: %r %r %r" % (pagename, attachmentname, revno))
00210                         if not attachmentname:
00211                             if revno is None:
00212                                 # generic "index this page completely, with attachments" request
00213                                 self._index_page(request, connection, pagename, mode='update')
00214                             else:
00215                                 # "index this page revision" request
00216                                 self._index_page_rev(request, connection, pagename, revno, mode='update')
00217                         else:
00218                             # "index this attachment" request
00219                             self._index_attachment(request, connection, pagename, attachmentname, mode='update')
00220                         done_count += 1
00221             finally:
00222                 logging.debug("updated xapian index with %d queued updates" % done_count)
00223                 connection.close()
00224         except XapianDatabaseLockError:
00225             # another indexer has locked the index, we can retry it later...
00226             logging.debug("can't lock xapian index, not doing queued updates now")

Here is the call graph for this function:

Check if index exists 

Reimplemented from MoinMoin.search.builtin.BaseIndex.

Definition at line 134 of file indexing.py.

00134 
00135     def exists(self):
00136         """ Check if index exists """
00137         return os.path.exists(self.db)

Here is the caller graph for this function:

Definition at line 149 of file indexing.py.

00149 
00150     def get_indexer_connection(self):
00151         return MoinIndexerConnection(self.db)

Here is the caller graph for this function:

Definition at line 146 of file indexing.py.

00146 
00147     def get_search_connection(self):
00148         return MoinSearchConnection(self.db)

Here is the caller graph for this function:

def MoinMoin.search.builtin.BaseIndex.indexPages (   self,
  files = None,
  mode = 'update',
  pages = None 
) [inherited]
Index pages (and files, if given)

@param files: iterator or list of files to index additionally
@param mode: set the mode of indexing the pages, either 'update' or 'add'
@param pages: list of pages to index, if not given, all pages are indexed

Definition at line 149 of file builtin.py.

00149 
00150     def indexPages(self, files=None, mode='update', pages=None):
00151         """ Index pages (and files, if given)
00152 
00153         @param files: iterator or list of files to index additionally
00154         @param mode: set the mode of indexing the pages, either 'update' or 'add'
00155         @param pages: list of pages to index, if not given, all pages are indexed
00156         """
00157         start = time.time()
00158         request = self._indexingRequest(self.request)
00159         self._index_pages(request, files, mode, pages=pages)
00160         logging.info("indexing completed successfully in %0.2f seconds." %
00161                     (time.time() - start))

Here is the call graph for this function:

Modification time of the index 

Reimplemented from MoinMoin.search.builtin.BaseIndex.

Definition at line 138 of file indexing.py.

00138 
00139     def mtime(self):
00140         """ Modification time of the index """
00141         return os.path.getmtime(self.db)

def MoinMoin.search.builtin.BaseIndex.optimize (   self) [inherited]
Optimize the index if possible 

Definition at line 183 of file builtin.py.

00183 
00184     def optimize(self):
00185         """ Optimize the index if possible """
00186         raise NotImplemented('...')

def MoinMoin.search.builtin.BaseIndex.search (   self,
  query,
  kw 
) [inherited]
Search for items in the index

@param query: the search query objects to pass to the index

Definition at line 130 of file builtin.py.

00130 
00131     def search(self, query, **kw):
00132         """ Search for items in the index
00133 
00134         @param query: the search query objects to pass to the index
00135         """
00136         return self._search(query, **kw)

Here is the call graph for this function:

Here is the caller graph for this function:

Touch the index 

Reimplemented from MoinMoin.search.builtin.BaseIndex.

Definition at line 142 of file indexing.py.

00142 
00143     def touch(self):
00144         """ Touch the index """
00145         filesys.touch(self.db)

def MoinMoin.search.builtin.BaseIndex.update_item (   self,
  pagename,
  attachmentname = None,
  revno = None,
  now = True 
) [inherited]
Update a single item (page or attachment) in the index

@param pagename: the name of the page to update
@param attachmentname: the name of the attachment to update
@param revno: a specific revision number (int) or None (all revs)
@param now: do all updates now (default: True)

Definition at line 137 of file builtin.py.

00137 
00138     def update_item(self, pagename, attachmentname=None, revno=None, now=True):
00139         """ Update a single item (page or attachment) in the index
00140 
00141         @param pagename: the name of the page to update
00142         @param attachmentname: the name of the attachment to update
00143         @param revno: a specific revision number (int) or None (all revs)
00144         @param now: do all updates now (default: True)
00145         """
00146         self.update_queue.put(pagename, attachmentname, revno)
00147         if now:
00148             self.do_queued_updates()

Here is the call graph for this function:


Member Data Documentation

Definition at line 124 of file indexing.py.

Definition at line 103 of file builtin.py.

Definition at line 102 of file builtin.py.

Definition at line 106 of file builtin.py.


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