[Zope] ZCatalog resources

sean.upton@uniontrib.com sean.upton@uniontrib.com
Mon, 09 Jul 2001 16:02:44 -0700


I am supposing that you are trying to search on one 'field' or mass of text;
what I am about to say would require a bit of modification and re-thought if
you were to combine searches on multiple fields (well, that is, if you need
cross-field OR searching; AND is already a de-facto reality across fields).

How is it that you are "revising" the search?  I'm supposing that you are
taking the original search, and combining the query verbatim with the
modifications, like:

originalquery + ' ' + modifications

Doing this (at least in Zope 2.3.x, I think) should result in an implicit
"AND" and limit the first set, but I think you need to gratuitously use
parentheses.  For example, in an classified ad application I have developed
using ZCatalog, there are lots of job entries for engineers, but I want to
modify it to only see something like environmental engineer jobs:

Suppose the original query is "engineer*" - also suppose that I want to
append a limiting term like "environment*" - I would rewrite the query
string for the textIndex I am searching to look like:
(engineer*) AND (environment*)

This limits 83 items in my test example to 6 matches.

and suppose, then, that I was looking for something in the Navy:
((environment*) AND (engineer*)) AND (naval)

This limits 6 items in my test example to 1 match.

All the extra parentheses don't seem to hurt, and seem to be necessary, to
some extent.

So, I guess, if you are trying to do limiting searches, you are going to
have to have some code that rewrites your query text, every time wrapping
your original search in parentheses and appending an AND and the new terms.
The python code for this might look like:
	newquery='(' + oldquery + ') AND (' + newquery + ')'

Then pass newquery as a form value for the index you are trying to search
using your form doing a <dtml-in Catalog>.

Good luck,
Sean

-----Original Message-----
From: complaw@hal-pc.org [mailto:complaw@hal-pc.org]
Sent: Monday, July 09, 2001 3:29 PM
To: sean.upton@uniontrib.com
Cc: zope@zope.org
Subject: RE: [Zope] ZCatalog resources


> Perhaps you can be more specific about your problems.  I suppose you are
> working with Text Indexes?  What sorts of indexes and queries are you
trying
> to set up; and on what sorts of datatypes?  I'm sure that I (and possbily
> others on the list) would be able to help guide you in your set up of the
> indexes you need in a manner that suits your search case.

Thanks Sean.  First, I've had no problem installing or indexing.  The
problems
come with searching for specific content.

It seems that the first search returns a seemingly correct result set
(meaning
that the list in the result set had the criteria).  However, when I revised
the
criteria (either to narrow the result set, or to get a completely different
result set) I got the original (first) result set instead.  Any change in
criteria yielded the same (large) result set.

Have you had that problem?

Ron

> 
> Sean
> 
> -----Original Message-----
> From: complaw@hal-pc.org [mailto:complaw@hal-pc.org]
> Sent: Monday, July 09, 2001 1:16 PM
> To: zope@zope.org
> Subject: [Zope] ZCatalog resources
> 
> 
> Is there a good resource for ZCatalog issues.  I've tried Chapter 9 of the
> Zope
> book, but only get the result if they have because they have only two
> objects.
> 
> My experience with the ZCatalog is that it returns far too many objects,
the
> vast majority of which do not satsify the criteria.  When I ask for the
> first
> set, it returns a correct result.  However, changing the criteria and
> resubmitting (by going back, chaning the criteria, and resubmitting) gives
> me
> the exact same (overly large) result set which now does NOT fit the search
> criteria.  I need a catalog but don't want to roll it out to users if I
> can't
> get it to work correctly.
> 
> Is there some nice neat resource that explains how to get the ZCatalog to
do
> one's bidding (or tell me what I'm doing wrong).
> 
> Cheers,
> 
> Ron
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>