Package Products :: Package ZenUtils :: Module Search |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenUtils.Search

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  __doc__="""Search
    12
    13  Utilities to help build zcatalog indexes
    14  """
    15
    16  from Products.ManagableIndex import FieldIndex, KeywordIndex
    17  from Products.ZenUtils.ExtendedPathIndex import ExtendedPathIndex
    18  from Products.ZenUtils.MultiPathIndex import MultiPathIndex
    19
    20 -def makeCaseInsensitiveFieldIndex(indexName, termType='ustring'):
    21      index = FieldIndex(indexName)
    22      index.PrenormalizeTerm = 'value/lower'
    23      index.TermType = termType
    24      return index
    25
    26 -def makeCaseInsensitiveKeywordIndex(indexName):
    27      index = KeywordIndex(indexName)
    28      index.PrenormalizeTerm = 'value/lower'
    29      index.TermType = 'ustring'
    30      index.TermTypeExtra = 'latin-1'
    31      return index
    32
    33 -def makeCaseSensitiveKeywordIndex(indexName):
    34      index = KeywordIndex(indexName)
    35      index.TermType = 'ustring'
    36      index.TermTypeExtra = 'latin-1'
    37      return index
    38
    39 -def makeCaseSensitiveFieldIndex(indexName):
    40      index = FieldIndex(indexName)
    41      index.TermType = 'ustring'
    42      return index
    43
    44 -def makeFieldIndex(indexName):
    45      return makeCaseInsensitiveFieldIndex(indexName)
    46
    47 -def makeKeywordIndex(indexName):
    48      return makeCaseInsensitiveKeywordIndex(indexName)
    49
    50 -def makePathIndex(indexName):
    51      __pychecker__="no-abstract"
    52      return ExtendedPathIndex(indexName)
    53
    54 -def makeMultiPathIndex(indexName):
    55      return MultiPathIndex(indexName)
    56