[Zope] - Search engine inside zope database (real)

simon@joyful.com simon@joyful.com
22 Jan 1999 12:51:53 -0800


chalaouxf@synbio.tpgnet.net (FR Chalaoux) writes:

> How is it possible to search inside a zope database all the 
> document objet containing a string occcurance (see regular 
> expression) and construct the result in a document with an 
> hypertexte link for each answer?

I posted some code which does this.. see msgid
<wk90ex6wuf.fsf@joyful.com> (or search for "PrincipiaFind") in the
list archive.

It searches for File objects containing a given string in the id or
title, and modified within the last N days. To use it you could:

1. save it in a .py file in zope/Extensions and then create an External
Object named "Find" in your zbase

2. create a search form which gathers obj_searchterm, obj_days &
search_sub then goes to a results page

3. in your results page use dtml something like this:

<!--#with "_.namespace(results=Find(this(),        
	obj_searchterm=obj_searchterm, 
        obj_days=obj_days, 
        search_sub=search_sub, 
        REQUEST=REQUEST))"-->
<!--#in results-->
<a href="<!--#var sequence-key -->">
<img src="<!--#var SCRIPT_NAME-->/<!--#var icon -->" border=0>
<!--#var sequence-key--></a>
<!--#/in-->
<!--#/with-->

Hope this helps,
-Simon