Re: [Zope-dev] Catalog class--does it support boolean queries?

2000-12-15 Thread Casey Duncan

Chris Withers wrote:
 
 Marc Conley wrote:
 
  boolean queries seem not to work. Should boolean queries work using Catalog
  or is it
  necessary to use ZCatalog instead to get that functionality?
 
 I'm not sure boolean queries work in either. If they do, anyone know
 where their syntax is documented?
 
 cheers,
 
 Chris

From digging around in the code, here is the general text index query
syntax (if you can call it that):

"one two three" and "one or two or three" are equivilant, multiple words
are "orified" by default. Hits are scored according to the number of
words matched, so by default, objects matching all words will be first
in the results. 

"one and two and three" and ['one','two','three'] will return only
objects containing all three words.

"one and not two" ('andnot' also works) works as advertised.

Wildcard characters "*" and "?" can be used to match multiple word
forms. e.g. a query for "great*" would match "great", "greats",
"greatest", "greatly", etc.

There is also a mentioned support for "near" searching in the code using
a '...' operator, although in practice this does not work 8^(. It seems
as though all non-aphanumerics are stripped from the query somewhere.
IMHO this should probably just use the word "near" as an operator
anyway.

For those interested, the indexing/searching code lives in {Zope
Dir}/lib/python/SearchIndex.

In doing some more digging in UnTextIndex.py there I do see support for
parens and quoted phases, although in practice they do not work. If I
find time I will delve into this further.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Catalog class--does it support boolean queries?

2000-12-15 Thread Casey Duncan

Chris Withers wrote:
 
 Casey Duncan wrote:
 
  In doing some more digging in UnTextIndex.py there I do see support for
  parens and quoted phases, although in practice they do not work. If I
  find time I will delve into this further.
 
 Cool, if you document it anywhere, please let us know...
 
 Chris

2.3.0a1 seems to be a bit more friendly toward near, and parens and
quoted phrase searches. I will be looking into this further. Perhaps a
howto is in order?
-- 
| Casey Duncan
| Kaivo, Inc.
| [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 )




[Zope-dev] Catalog class--does it support boolean queries?

2000-12-14 Thread Marc Conley

I am working on a project which requires the use of the Catalog class 
(versus ZCatalog) for
indexing and querying. I have basic full text indexing and querying working 
correctly but
boolean queries seem not to work. Should boolean queries work using Catalog 
or is it
necessary to use ZCatalog instead to get that functionality?

This is how I am submitting the query to the Catalog object:

results = sdb.cat({"content" : query})

where sdb is a ZODB, cat is the catalog object, and content is the name of 
the full-text index. query is
the query the user typed, which could be

"(apples and oranges) or plums"

(without the quotes) for instance. Thanks in advance for any assistance 
anyone can provide on this question.




___
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] Catalog class--does it support boolean queries?

2000-12-14 Thread Casey Duncan

Marc Conley wrote:
 
 I am working on a project which requires the use of the Catalog class
 (versus ZCatalog) for
 indexing and querying. I have basic full text indexing and querying working
 correctly but
 boolean queries seem not to work. Should boolean queries work using Catalog
 or is it
 necessary to use ZCatalog instead to get that functionality?
 
 This is how I am submitting the query to the Catalog object:
 
 results = sdb.cat({"content" : query})
 
 where sdb is a ZODB, cat is the catalog object, and content is the name of
 the full-text index. query is
 the query the user typed, which could be
 
 "(apples and oranges) or plums"
 
 (without the quotes) for instance. Thanks in advance for any assistance
 anyone can provide on this question.

You should be able to do what you want using just catalog.

If your example query is an example of something you are really using,
try it without parens.

e.g. "apples and oranges or plums"

AFAIK grouping in query strings is not supported.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Catalog class--does it support boolean queries?

2000-12-14 Thread Dieter Maurer

Marc Conley writes:
  
  Should boolean queries work using Catalog 
  or is it
  necessary to use ZCatalog instead to get that functionality?
  
ZCatalog is nothing more than a thin wrapper around
Catalog (to make a Catalog a persistent object in ZODB).
All search facilities of ZCatalog are in fact implemented
by Catalog.

This implies: Catalog can do boolean queries.


Note: the catalog has notorious bugs (at least until
Zope 2.2.2). If it does not work, it may be one
of these bugs.


Dieter

___
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 )