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

Source Code for Module ZenUtils.Search

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 as published by 
 8  # the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  __doc__="""Search 
15   
16  Utilities to help build zcatalog indexes 
17  """ 
18   
19  __version__ = "$Revision: 1.3 $"[11:-2] 
20   
21  from Products.ManagableIndex import FieldIndex, KeywordIndex, PathIndex 
22  from Products.ZenUtils.MultiPathIndex import MultiPathIndex 
23   
24 -def makeCaseInsensitiveFieldIndex(indexName, termType='ustring'):
25 index = FieldIndex(indexName) 26 index.PrenormalizeTerm = 'value/lower' 27 index.TermType = termType 28 return index
29
30 -def makeCaseInsensitiveKeywordIndex(indexName):
31 index = KeywordIndex(indexName) 32 index.PrenormalizeTerm = 'value/lower' 33 index.TermType = 'ustring' 34 index.TermTypeExtra = 'latin-1' 35 return index
36
37 -def makeCaseSensitiveKeywordIndex(indexName):
38 index = KeywordIndex(indexName) 39 index.TermType = 'ustring' 40 index.TermTypeExtra = 'latin-1' 41 return index
42
43 -def makeCaseSensitiveFieldIndex(indexName):
44 index = FieldIndex(indexName) 45 index.TermType = 'ustring' 46 return index
47
48 -def makeFieldIndex(indexName):
49 return makeCaseInsensitiveFieldIndex(indexName)
50
51 -def makeKeywordIndex(indexName):
52 return makeCaseInsensitiveKeywordIndex(indexName)
53
54 -def makePathIndex(indexName):
55 __pychecker__="no-abstract" 56 return PathIndex(indexName)
57
58 -def makeMultiPathIndex(indexName):
59 return MultiPathIndex(indexName)
60