[Zope] ZCatalog resources
sean.upton@uniontrib.com
sean.upton@uniontrib.com
Tue, 10 Jul 2001 10:15:58 -0700
I would think that the best way to debug your problem is to include
<dtml-var REQUEST> at the bottom of your results page, below the </dtml-in>
tag... That way, you can see what the form values are. ZCatalog just looks
at the REQUEST namespace for submitted form values, and uses them as
searches on it's indexes. So, for example, one of my applications has a
method that renders some "weighted" search text for the search engine
(ZCatalog) to index - my method is called "searchTextWeighted," and it
outputs the text I want indexed. There is an index added to ZCatalog's
index tab for "searchTextWeighted" as a TextIndex so that I can have the
results indexed, and when I pass the full query in a GET or POST form value
with the name of searchTextWeighted, it seems to work.
A lot of getting the search set up the way you want might involve a bit of
trial-and-error, some reading, patience, and some questions to the list; I'm
sure you'll get it working the way you want eventually; that's the approach
that I have had to take. Perhaps when I am all done with my current project
(which is very search-intensive), I will write a howto...
Sean
-----Original Message-----
From: Ronald.Chichester@bakerbotts.com
[mailto:Ronald.Chichester@bakerbotts.com]
Sent: Tuesday, July 10, 2001 6:50 AM
To: sean.upton@uniontrib.com
Subject: RE: [Zope] ZCatalog resources
Sean:
I guess I'm having more fundamental trouble than I first thought. I added a
ZCatalog to a folder and indexed it. In the process, it created a Report
and a Search file. To test it, I input a search term (single word) into the
principa field. It returned quite a few hits that seemed reasonable for the
(broad or common) term that I used. Then I went back to the search form and
took out the broad word and put in another word that should have returned a
much narrower result set. Instead, it gave me the exact same result set,
even though I knew for a fact that many of the items returned did not
contain the new search term.
Something is clearly not right.
Thanks for the information below, however. Once I get a working ZCatalog,
I'll put your tips to good use.
Incidentally, how did you learn all these tips about the ZCatalog?
Best wishes,
Ron
-----Original Message-----
From: sean.upton@uniontrib.com [mailto:sean.upton@uniontrib.com]
Sent: Monday, July 09, 2001 6:03 PM
To: complaw@hal-pc.org
Cc: zope@zope.org
Subject: RE: [Zope] ZCatalog resources
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 )
>