[Zope-Checkins] CVS: Zope2 - FieldIndex.py:1.1.2.1 FieldIndex.pyc:1.1.2.1 KeywordIndex.py:1.1.2.1 KeywordIndex.pyc:1.1.2.1 PathIndex.py:1.1.2.1 TextIndex.py:1.1.2.1 TextIndex.pyc:1.1.2.1 __init__.py:1.1.2.1 __init__.pyc:1.1.2.1

andreas@digicool.com andreas@digicool.com
Wed, 9 May 2001 09:10:29 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/Products/PluginIndexes
In directory korak:/tmp/cvs-serv7593

Added Files:
      Tag: ajung-dropin-registry
	FieldIndex.py FieldIndex.pyc KeywordIndex.py KeywordIndex.pyc 
	PathIndex.py TextIndex.py TextIndex.pyc __init__.py 
	__init__.pyc 
Log Message:
import



--- Added File FieldIndex.py in package Zope2 ---
import SearchIndex.PluggableIndex 
import SearchIndex.UnIndex

from Globals import Persistent, DTMLFile
from Acquisition import Implicit
from OFS.History import Historical
from OFS.SimpleItem import SimpleItem

_marker = []

class FieldIndex(SearchIndex.PluggableIndex.PluggableIndex, Persistent,
    Implicit, SimpleItem):
    """Field Indexes"""

    __implements__ = (SearchIndex.PluggableIndex.PluggableIndexInterface,)

    meta_type="FieldIndex"

    manage_options= (
        SimpleItem.manage_options 
    )

    def __init__(self, name, caller):
        self.id = name
        self._index = SearchIndex.UnIndex.UnIndex(name)

    def __len__(self):
        return len(self._index)

    def __nonzero__(self):
        return not not self._index

    def getentryForObject(self, documentId, default=_marker):
        if default is _marker:
            return self._index.getEntryForObject(documentId)
        else:
            return self._index.getEntryForObject(documentId, default)

    def index_object(self, documentId, obj, threshold=None):
        return self._index.index_object(documentId, obj, threshold)

    def unindex_object(self, documentId):
        return self._index.unindex_object(documentId)

    def _apply_index(self, request, cid=''):
        return self._index._apply_index(request, cid)

    def uniqueValues(self, name=None, withLengths=0):
        return self._index.uniqueValues(name, withLengths)

    index_html = DTMLFile('dtml/index', globals())

manage_addFieldIndexForm = DTMLFile('dtml/addFieldIndex', globals())

def manage_addFieldIndex(self, id, REQUEST=None, submit=None):
    """Add a field index"""
    return self.manage_addIndex(id, 'FieldIndex', REQUEST)



--- Added File FieldIndex.pyc in package Zope2 ---
*ë
Có:c




























--- Added File KeywordIndex.py in package Zope2 ---
import SearchIndex.PluggableIndex 
import SearchIndex.UnKeywordIndex

from Globals import Persistent, DTMLFile
from Acquisition import Implicit
from OFS.History import Historical
from OFS.SimpleItem import SimpleItem

_marker = []

class KeywordIndex(SearchIndex.PluggableIndex.PluggableIndex, Persistent,
    Implicit, SimpleItem):

    """Keyword Indexes"""

    __implements__ = (SearchIndex.PluggableIndex.PluggableIndexInterface,)

    meta_type="KeywordIndex"

    manage_options= (
        SimpleItem.manage_options 
    )

    def __init__(self, name, caller):
        self.id = name
        self._index = SearchIndex.UnKeywordIndex.UnKeywordIndex(name)

    def __len__(self):
        return len(self._index)

    def __nonzero__(self):
        return not not self._index

    def getentryForObject(self, documentId, default=_marker):
        if default is _marker:
            return self._index.getEntryForObject(documentId)
        else:
            return self._index.getEntryForObject(documentId, default)

    def index_object(self, documentId, obj, threshold=None):
        return self._index.index_object(documentId, obj, threshold)

    def unindex_object(self, documentId):
        return self._index.unindex_object(documentId)

    def _apply_index(self, request, cid=''):
        return self._index._apply_index(request, cid)

    def uniqueValues(self, name=None, withLengths=0):
        return self._index.uniqueValues(name, withLengths)

    index_html = DTMLFile('dtml/index', globals())

manage_addKeywordIndexForm = DTMLFile('dtml/addKeywordIndex', globals())

def manage_addKeywordIndex(self, id, REQUEST=None, submit=None):
    """Add a keyword index"""
    return self.manage_addIndex(id, 'KeywordIndex', REQUEST)

--- Added File KeywordIndex.pyc in package Zope2 ---
*ë
8ó:c






















--- Added File PathIndex.py in package Zope2 ---
import SearchIndex.PluggableIndex 
import SearchIndex.PathIndex

from Globals import Persistent, DTMLFile
from Acquisition import Implicit
from OFS.History import Historical
from OFS.SimpleItem import SimpleItem

_marker = []

class TextIndex(SearchIndex.PluggableIndex.PluggableIndex, Persistent,
    Implicit, SimpleItem):
    """Path Indexes"""

    __implements__ = (SearchIndex.PluggableIndex.PluggableIndexInterface,)

    meta_type="PathIndex"

    manage_options= (
        SimpleItem.manage_options 
    )

    def __init__(self, name, catalog):
        
        self.id = name

        self._index = SearchIndex.PathIndex.PathIndex(name)

    def __len__(self):
        return len(self._index)

    def __nonzero__(self):
        return not not self._index

    def getentryForObject(self, documentId, default=_marker):
        if default is _marker:
            return self._index.getEntryForObject(documentId)
        else:
            return self._index.getEntryForObject(documentId, default)

    def index_object(self, documentId, obj, threshold=None):
        return self._index.index_object(documentId, obj, threshold)

    def unindex_object(self, documentId):
        return self._index.unindex_object(documentId)

    def _apply_index(self, request, cid=''):
        return self._index._apply_index(request, cid)

    def uniqueValues(self, name=None, withLengths=0):
        return self._index.uniqueValues(name, withLengths)

    index_html = DTMLFile('dtml/index', globals())

manage_addTextIndexForm = DTMLFile('dtml/addTextIndex', globals())

def manage_addTextIndex(self, id, REQUEST=None, submit=None):
    """Add a path index"""
    return self.manage_addIndex(id, 'PathIndex', REQUEST)

--- Added File TextIndex.py in package Zope2 ---
import SearchIndex.PluggableIndex 
import SearchIndex.UnTextIndex

from Globals import Persistent, DTMLFile
from Acquisition import Implicit
from OFS.History import Historical
from OFS.SimpleItem import SimpleItem

_marker = []

class TextIndex(SearchIndex.PluggableIndex.PluggableIndex, Persistent,
    Implicit, SimpleItem):
    """Text Indexes"""

    __implements__ = (SearchIndex.PluggableIndex.PluggableIndexInterface,)

    meta_type="TextIndex"

    manage_options= (
        SimpleItem.manage_options 
    )

    def __init__(self, name, catalog):
        
        self.id = name

        lexicon = catalog.vocab_id
        if type(lexicon) is type (''):
            lexicon=getattr(catalog, lexicon).getLexicon()

        print "Lexicon is %s" % lexicon

        self._index = SearchIndex.UnTextIndex.UnTextIndex(name, None, None,
            lexicon)

    def __len__(self):
        return len(self._index)

    def __nonzero__(self):
        return not not self._index

    def getentryForObject(self, documentId, default=_marker):
        if default is _marker:
            return self._index.getEntryForObject(documentId)
        else:
            return self._index.getEntryForObject(documentId, default)

    def index_object(self, documentId, obj, threshold=None):
        return self._index.index_object(documentId, obj, threshold)

    def unindex_object(self, documentId):
        return self._index.unindex_object(documentId)

    def _apply_index(self, request, cid=''):
        return self._index._apply_index(request, cid)

    def uniqueValues(self, name=None, withLengths=0):
        return self._index.uniqueValues(name, withLengths)

    index_html = DTMLFile('dtml/index', globals())

manage_addTextIndexForm = DTMLFile('dtml/addTextIndex', globals())

def manage_addTextIndex(self, id, REQUEST=None, submit=None):
    """Add a text index"""
    return self.manage_addIndex(id, 'TextIndex', REQUEST)

--- Added File TextIndex.pyc in package Zope2 ---
*ë
Ió:c

























--- Added File __init__.py in package Zope2 ---

import FieldIndex, KeywordIndex, TextIndex, PathIndex

def initialize(context):

    context.registerClass(
        FieldIndex.FieldIndex,
        permission='Add Pluggable Index',
        constructors=(manage_addFieldIndexForm,
                      manage_addFieldIndex),
        icon="www/index.gif",
        visibility=None
    )

    context.registerClass(
        KeywordIndex.KeywordIndex,
        permission='Add Pluggable Index',
        constructors=(manage_addKeywordIndexForm,
                      manage_addKeywordIndex),
        icon="www/index.gif",
        visibility=None
    )

    context.registerClass(
        TextIndex.TextIndex,
        permission='Add Pluggable Index',
        constructors=(manage_addTextIndexForm,
                      manage_addTextIndex),
        icon="www/index.gif",
        visibility=None
    )

    context.registerClass(
        PathIndex.PathIndex,
        permission='Add Pluggable Index',
        constructors=(manage_addPathIndexForm,
                      manage_addPathIndex),
        icon="www/index.gif",
        visibility=None
    )

    context.registerHelp()
    context.registerHelpTitle('Indexes (Pluggable)')

manage_addFieldIndexForm = FieldIndex.manage_addFieldIndexForm
manage_addFieldIndex= FieldIndex.manage_addFieldIndex

manage_addKeywordIndexForm = KeywordIndex.manage_addKeywordIndexForm
manage_addKeywordIndex= KeywordIndex.manage_addKeywordIndex

manage_addTextIndexForm = TextIndex.manage_addTextIndexForm
manage_addTextIndex= TextIndex.manage_addTextIndex

manage_addPathIndexForm = PathIndex.manage_addPathIndexForm
manage_addPathIndex= PathIndex.manage_addPathIndex

print 'end of init'

--- Added File __init__.pyc in package Zope2 ---
*ë
¿2ù:c