Re: [Zope] case insensitive search?
In article <00c601c0766e$c8280540$ae03a8c0@fork>, Andy McKay <[EMAIL PROTECTED]> writes >No im being stupid and did a replace of sort for search in my caffeine >deprived brain. >-- > Andy McKay, Developer. > ActiveState. > > ... nevEr miNd we're all a BIt dUMb nOW and THEn :) -- Robin Becker ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] case insensitive search?
No im being stupid and did a replace of sort for search in my caffeine deprived brain. -- Andy McKay, Developer. ActiveState. - Original Message - From: "Chris Withers" <[EMAIL PROTECTED]> To: "Andy McKay" <[EMAIL PROTECTED]> Cc: "Aleksander Salwa" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, January 04, 2001 2:00 AM Subject: Re: [Zope] case insensitive search? > Andy McKay wrote: > > > > The checkbox is good, but surely the patch should be in presentation layer > > (dtml-in) and not just in Find Support. My patch fixes it throughout Zope... > > Hangon... I think this is case insensitive search, not sort ;-) > > eg: when searching for 'fIsh', that would return objects containing > 'fish', 'fIsh' and 'fiSH'. > > Not sure how your patch helps here, but I'm probably being stupid :-) > > cheers, > > Chris > > ___ > Zope maillist - [EMAIL PROTECTED] > 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 - [EMAIL PROTECTED] 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 )
Re: [Zope] case insensitive search?
Andy McKay wrote: > > The checkbox is good, but surely the patch should be in presentation layer > (dtml-in) and not just in Find Support. My patch fixes it throughout Zope... Hangon... I think this is case insensitive search, not sort ;-) eg: when searching for 'fIsh', that would return objects containing 'fish', 'fIsh' and 'fiSH'. Not sure how your patch helps here, but I'm probably being stupid :-) cheers, Chris ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] case insensitive search?
In article, Aleksander Salwa <[EMAIL PROTECTED]> writes >On Wed, 3 Jan 2001, Robin Becker wrote: > >> Is there an easy way to make the Find tab case insensitive. It seems >> like a very common need, but I see that FindSupport.py is calling >> string.find which makes it seem as though this is harder than it should >> be. > >Now, I did it better way. No regular expressions. Just case-insensitive >search. "Case insensitive" checkbox on "Find" form. >If you need it - just take a look at an attachment. >Maybe I will send it to the Collector... > > >[EMAIL PROTECTED], [EMAIL PROTECTED] > >/--\ >| `long long long' is too long for GCC | >\--/ > >[ A MIME APPLICATION / x-gtar part was included here. ] > that looks like a nice way to do it, but I reckon we could make the lambda stuff a bit cleverer ie modify the default find eg if search_caseins: FINDER = lambda ob,p=lower(obj_searchterm): find(lower(ob.PrincipiaSearchSource()),p) else: FINDER = lambda ob,p=obj_searchterm: find(ob.PrincipiaSearchSource(), p) and then we use FINDER(ob) -- Robin Becker ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] case insensitive search?
> > Is there an easy way to make the Find tab case insensitive. It seems > > like a very common need, but I see that FindSupport.py is calling > > string.find which makes it seem as though this is harder than it should > > be. > > Now, I did it better way. No regular expressions. Just case-insensitive > search. "Case insensitive" checkbox on "Find" form. > If you need it - just take a look at an attachment. > Maybe I will send it to the Collector... The checkbox is good, but surely the patch should be in presentation layer (dtml-in) and not just in Find Support. My patch fixes it throughout Zope... -- Andy McKay, Developer. ActiveState. ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] case insensitive search?
On Wed, 3 Jan 2001, Robin Becker wrote: > Is there an easy way to make the Find tab case insensitive. It seems > like a very common need, but I see that FindSupport.py is calling > string.find which makes it seem as though this is harder than it should > be. Now, I did it better way. No regular expressions. Just case-insensitive search. "Case insensitive" checkbox on "Find" form. If you need it - just take a look at an attachment. Maybe I will send it to the Collector... [EMAIL PROTECTED], [EMAIL PROTECTED] /--\ | `long long long' is too long for GCC | \--/ caseInsensitiveFind.tgz
Re: [Zope] case insensitive search?
A less easy way is to patch dtml-in so its allows sorts where it is case insensitive. Theres a simple patch for this here: http://www.zope.org/Members/andym/IgnoreCase Then patch the findResult.dtml, dtml source: lib\python\OFS\findResult.dtml line 44: This will allow you to fix any management screen/sort using dtml-in to be case insensitive. There are other options of course. -- Andy McKay, Developer. ActiveState. - Original Message - From: "Robin Becker" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 02, 2001 5:16 PM Subject: [Zope] case insensitive search? > Is there an easy way to make the Find tab case insensitive. It seems > like a very common need, but I see that FindSupport.py is calling > string.find which makes it seem as though this is harder than it should > be. > -- > Robin Becker > > ___ > Zope maillist - [EMAIL PROTECTED] > 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 - [EMAIL PROTECTED] 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 )
Re: [Zope] case insensitive search?
On Wed, 3 Jan 2001, Robin Becker wrote: > Is there an easy way to make the Find tab case insensitive. It seems > like a very common need, but I see that FindSupport.py is calling > string.find which makes it seem as though this is harder than it should > be. You can try my very quick patch, attached below. But beware - it gives much more that you want - it is full regexp search. --- FindSupport.py Wed Jul 26 16:11:54 2000 +++ FindSupport_caseIns.py Wed Jan 3 09:33:34 2001 @@ -92,7 +92,7 @@ from Globals import HTMLFile from DocumentTemplate.DT_Util import InstanceDict, TemplateDict from DateTime import DateTime -from string import find +from re import search, IGNORECASE from AccessControl import getSecurityManager class FindSupport(ExtensionClass.Base): @@ -177,7 +177,8 @@ and (not obj_searchterm or (hasattr(ob, 'PrincipiaSearchSource') and - find(ob.PrincipiaSearchSource(), obj_searchterm) >= 0 + search(obj_searchterm, ob.PrincipiaSearchSource(), + IGNORECASE) != None )) and (not obj_expr or expr_match(ob, obj_expr)) @@ -269,7 +270,8 @@ and (not obj_searchterm or (hasattr(ob, 'PrincipiaSearchSource') and - find(ob.PrincipiaSearchSource(), obj_searchterm) >= 0 + search(obj_searchterm, ob.PrincipiaSearchSource(), + IGNORECASE) != None )) and (not obj_expr or expr_match(ob, obj_expr)) ___ Zope maillist - [EMAIL PROTECTED] 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] case insensitive search?
Is there an easy way to make the Find tab case insensitive. It seems like a very common need, but I see that FindSupport.py is calling string.find which makes it seem as though this is harder than it should be. -- Robin Becker ___ Zope maillist - [EMAIL PROTECTED] 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 )