Catalog Query Feature Request, was: RE: [Zope-dev] An idea for Un iqueValuesFor
I could definitely see the value of a unique-values query into ZCatalog, especially for creating things using <dtml-tree> using keywords, etc... On a slightly related (well, not really) note, CatalogQuery looks like it would solve a lot of problems I have had with a very Catalog-intensive application. One thought I had - I might suggest the possibility of adding a fuzzy matching operator to CatalogQuery that performs the function of wrapping wildcard searches on search terms for Text Indexes, supposing the Catalog is using a globbing vocabulary: ~= as an operator would mean an approximate (substring) match So a search for 'title ~= "engineer"' would perform a search for '*engineer*' and return results containing words like engineer, engineers, engineering, etc. Right now, I attempt to safely rewrite REQUEST['someFieldThatIamSearching'] with a Python class method that uses a zillion re.sub() calls to wrap search terms in * characters; I wonder if there is a way to alternately implement something like this at a lower level, perhaps in CatalogQuery; I get the feeling it would be quicker and much more simple. If something like that were implemented as well as some equivalent to sort_on, I'd stop pulling my hair out with traditional workarounds and definitely switch all my stuff to use CatalogQuery instead... Thoughts? Sean -----Original Message----- From: Casey Duncan [mailto:cduncan@kaivo.com] Sent: Monday, July 30, 2001 8:20 AM To: Chris Withers Cc: zope-dev@zope.org; Anthony Baxter Subject: Re: [Zope-dev] An idea for UniqueValuesFor Chris Withers wrote:
Casey Duncan wrote:
possibly, yes. I'll look to add this to my CatalogQuery product. I believe the btrees can be pressed into service here...
Hadn't heard of this CatalogQuery product... where can I find out more?
I think I may have been about to develop something similar, so maybe we
can help
each otehr out?
cheers,
Chris
http://www.zope.org/Members/Kaivo/CatalogQuery This is my first stab at this. I forsee a much more general query mechanism in the future, but this works better than the stock stuff (for me) and it works today! Let me know what your ideas are... -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------> _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org 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 )
sean.upton@uniontrib.com wrote:
I could definitely see the value of a unique-values query into ZCatalog, especially for creating things using <dtml-tree> using keywords, etc...
I'm wondering the best way to implement this on the API side, since it would change the output from catalog results to just attribute values. Any thoughts?
On a slightly related (well, not really) note, CatalogQuery looks like it would solve a lot of problems I have had with a very Catalog-intensive application. One thought I had - I might suggest the possibility of adding a fuzzy matching operator to CatalogQuery that performs the function of wrapping wildcard searches on search terms for Text Indexes, supposing the Catalog is using a globbing vocabulary:
~= as an operator would mean an approximate (substring) match
So a search for 'title ~= "engineer"' would perform a search for '*engineer*' and return results containing words like engineer, engineers, engineering, etc.
That sounds like a good idea. Would a simple split/join work, something like: ops = ('and', 'or') words = query_string.lower().split() for word in words: if word not in ops: word = '*%s*' % word query_string = words.join() I can look at adding this capability
Right now, I attempt to safely rewrite REQUEST['someFieldThatIamSearching'] with a Python class method that uses a zillion re.sub() calls to wrap search terms in * characters; I wonder if there is a way to alternately implement something like this at a lower level, perhaps in CatalogQuery; I get the feeling it would be quicker and much more simple.
If something like that were implemented as well as some equivalent to sort_on, I'd stop pulling my hair out with traditional workarounds and definitely switch all my stuff to use CatalogQuery instead...
Yeah, I definitely want to add a sort_on capability. I think I will implement it as an optional argument, like it is for ZCatalog, rather than as part of the query string, at least for now.
Thoughts?
Sean
-----Original Message----- From: Casey Duncan [mailto:cduncan@kaivo.com] Sent: Monday, July 30, 2001 8:20 AM To: Chris Withers Cc: zope-dev@zope.org; Anthony Baxter Subject: Re: [Zope-dev] An idea for UniqueValuesFor
Chris Withers wrote:
Casey Duncan wrote:
possibly, yes. I'll look to add this to my CatalogQuery product. I believe the btrees can be pressed into service here...
Hadn't heard of this CatalogQuery product... where can I find out more?
I think I may have been about to develop something similar, so maybe we
can help
each otehr out?
cheers,
Chris
http://www.zope.org/Members/Kaivo/CatalogQuery
This is my first stab at this. I forsee a much more general query mechanism in the future, but this works better than the stock stuff (for me) and it works today!
Let me know what your ideas are...
-- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org 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 )
-- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
Casey Duncan wrote:
I'm wondering the best way to implement this on the API side, since it would change the output from catalog results to just attribute values. Any thoughts?
Have it as a separate method to your query method. Then, you can use one method within the other if you push the Catalog onto whatever is passed as the query's namespace stack. -- Steve Alexander Software Engineer Cat-box limited
sean.upton@uniontrib.com wrote:
I could definitely see the value of a unique-values query into ZCatalog, especially for creating things using <dtml-tree> using keywords, etc...
Think categorized views from Lotus Notes ;-)
So a search for 'title ~= "engineer"' would perform a search for '*engineer*' and return results containing words like engineer, engineers, engineering, etc.
Hmmm, you wanna look at stemming algorithms for that too... This might be something worth turning into a pluggable index... cheers, Chris
participants (4)
-
Casey Duncan -
Chris Withers -
sean.upton@uniontrib.com -
Steve Alexander