RE: [Zope-dev] More ZCatalog Stuff.

2001-02-27 Thread Toby Dickenson

 I am assuming that the code you provided goes into a
 manage_addCustomIndex method that is part of a CustomIndex
 Python Product.

hehehehe, nothing so general-purpose as that ;-)
 
  You will need to implement a subclass derived from one of 
 the standard
  indexes to provide your custom indexing policy, whatever that is.
 
 Can you provide the code for your custom KeywordIndex, so I
 have a starting point? I realize yours subclasses a
 KeywordIndex, and I probably need to subclass a TextIndex,
 but it would still probably help. I can integrate and hack
 on other peoples code better than I can write my own from
 scratch.


from SearchIndex.UnKeywordIndex import UnKeywordIndex, MV, intSet
from types import ListType, TupleType

class UnTrackingIndex(UnKeywordIndex):

meta_type = 'Tracking Properties Index'

"""Like a Keyword Index, only it indexes tracking properties
"""

def __init__(self,question):
id = 'tracking_'+unicode(question).encode('unicode-escape')
self.question = question
UnKeywordIndex.__init__(self,id)

def index_object(self, i, obj, threshold=None):
""" index an object 'obj' with integer id 'i'"""

index = self._index
unindex = self._unindex

try:
kws = obj.tracking_answers(self.question)
if type(kws) not in [type([]),type(())]:
raise ValueError('Indexing a tracking property set of
inappropriate type %r' % type(kws))
except:
kws = (MV,)

# index each item in the sequence
for kw in kws:
set = index.get(kw)
if set is None:
index[kw] = set = intSet()
set.insert(i)

unindex[i] = tuple(kws)

self._index = index
self._unindex = unindex

return 1


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] More ZCatalog Stuff.

2001-02-26 Thread Michael R. Bernstein

Toby Dickenson wrote:
 
 If you are interested in a short-term hack, it is possible implement
 your own type of index and add it to an existing catalog, without
 having to modify any of the ZCatalog product.

Ok, how? Please keep in mind that I'm more of a designer and
integrator than a coder.

Thanks,

Michael Bernstein.

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] More ZCatalog Stuff.

2001-02-25 Thread Christopher Petrilli

Steve Alexander [[EMAIL PROTECTED]] wrote:
 Christopher Petrilli wrote:
 
  
  SMOC :-)
 
 You're in the South Michigan Orienteering Club?
http://www.angelfire.com/mi/SMOC/

Oh sorry, old reference... SMOC = Simple Matter of Code :)

Chris
-- 
| Christopher Petrilli
| [EMAIL PROTECTED]

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] More ZCatalog Stuff.

2001-02-24 Thread Chris Withers

"Michael R. Bernstein" wrote:
 
 Hmm. this seems like there ought to be a checkbox next to
 the 'Add Index' form field labeled 'index numbers?'. Or
 maybe a 'Text and Numbers' index as an additional index
 type.

I like these ideas :-)

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )