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   
23 -def makeCaseInsensitiveFieldIndex(indexName, termType='ustring'):
24 index = FieldIndex(indexName) 25 index.PrenormalizeTerm = 'value/lower' 26 index.TermType = termType 27 return index
28
29 -def makeCaseInsensitiveKeywordIndex(indexName):
30 index = KeywordIndex(indexName) 31 index.PrenormalizeTerm = 'value/lower' 32 index.TermType = 'ustring' 33 index.TermTypeExtra = 'latin-1' 34 return index
35
36 -def makeCaseSensitiveKeywordIndex(indexName):
37 index = KeywordIndex(indexName) 38 index.TermType = 'ustring' 39 index.TermTypeExtra = 'latin-1' 40 return index
41
42 -def makeCaseSensitiveFieldIndex(indexName):
43 index = FieldIndex(indexName) 44 index.TermType = 'ustring' 45 return index
46
47 -def makeFieldIndex(indexName):
48 return makeCaseInsensitiveFieldIndex(indexName)
49
50 -def makeKeywordIndex(indexName):
51 return makeCaseInsensitiveKeywordIndex(indexName)
52
53 -def makePathIndex(indexName):
54 return PathIndex(indexName)
55