From: Justin K. <jus...@gm...> - 2011-02-02 06:08:57
|
Is it possible to search a string type property in a case-insensitive way? The normal MW full-page text search is case-insensitive, so I am using that for now, but I would like to do case in-sensitive searches on properties via SMW forms as well. I found: http://www.mediawiki.org/wiki/Extension:AskQ which appears to do case-insensitive searches, but I have been unable to get it to return results. two threads that mention case-insensitive searching: http://sourceforge.net/mailarchive/message.php?msg_id=25053445 http://sourceforge.net/mailarchive/message.php?msg_id=21397763 -Justin |
From: Alex M. H. <amh...@on...> - 2011-02-02 08:15:44
|
Justin, The following should work: {{#ask: <q>[[String property::~*search value*]] OR [[string property::~*{{lc:search value}}*]]</q>}} If you're looking for exact matches, omit the asterisks. The {{lc: magic word is probably unnecessary, but I've found it helpful when searching for strings in the middle of other strings. I'm not sure how well this will work for form inputs, however. Also, AskQ looks like a really interesting extension, though, thanks for pointing that out! Hope this helps, Alex -- ontolawgy™ LLC: connect . . . the . . . dots™ http://ontolawgy.com From: Justin Keogh <jus...@gm...> To: sem...@li... Subject: [Semediawiki-user] Case-insensitive searching of SMW properties Date: Tue, 1 Feb 2011 23:08:14 -0700 Is it possible to search a string type property in a case-insensitive way? The normal MW full-page text search is case-insensitive, so I am using that for now, but I would like to do case in-sensitive searches on properties via SMW forms as well. I found: http://www.mediawiki.org/wiki/Extension:AskQ which appears to do case-insensitive searches, but I have been unable to get it to return results. two threads that mention case-insensitive searching: http://sourceforge.net/mailarchive/message.php?msg_id=25053445 http://sourceforge.net/mailarchive/message.php?msg_id=21397763 -Justin ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Semediawiki-user mailing list Sem...@li... https://lists.sourceforge.net/lists/listinfo/semediawiki-user |
From: Justin K. <jus...@gm...> - 2011-02-02 08:45:51
|
I gave it a try and {{#ask: <q>[[String property::~*search value*]] OR [[string property::~*{{lc:search value}}*]]</q>}} omits pages with [[String Property::SEARCH VALUE]] in caps so it returns a different number of results than: {{#ask: <q>[[String property::~*SEARCH VALUE*]] OR [[string property::~*{{lc:SEARCH VALUE}}*]]</q>}} A couple things I dont understand... where does "OR" come from? It's difficult to search for "OR" and I cant find docs about "OR" on the #ask help pages.... also in: {{#ask: <q>[[String property::~*search value*]] OR [[string property::~*{{lc:search value}}*]]</q>}} that reads like it would match anything with "search value" in it or the lower case version of "search value" (unchanged in this example) but what about matching a page containing a property with the value "sEaRcH vALuE"? Thanks for the help! -Justin On Wed, Feb 2, 2011 at 1:14 AM, Alex M. Hendler <amh...@on...>wrote: > Justin, > > The following should work: > > {{#ask: <q>[[String property::~*search value*]] OR [[string > property::~*{{lc:search value}}*]]</q>}} > > If you're looking for exact matches, omit the asterisks. The {{lc: magic > word is probably unnecessary, but I've found it helpful when searching > for strings in the middle of other strings. > > I'm not sure how well this will work for form inputs, however. > > Also, AskQ looks like a really interesting extension, though, thanks for > pointing that out! > > Hope this helps, > Alex > > > -- > ontolawgy™ LLC: connect . . . the . . . dots™ > http://ontolawgy.com > > > From: Justin Keogh <jus...@gm...> > To: sem...@li... > Subject: [Semediawiki-user] Case-insensitive searching of SMW properties > Date: Tue, 1 Feb 2011 23:08:14 -0700 > > Is it possible to search a string type property in a case-insensitive way? > > The normal MW full-page text search is case-insensitive, so I am using that > for now, but I would like to do case in-sensitive searches on properties > via > SMW forms as well. > > I found: http://www.mediawiki.org/wiki/Extension:AskQ which appears to do > case-insensitive searches, but I have been unable to get it to return > results. > > two threads that mention case-insensitive searching: > http://sourceforge.net/mailarchive/message.php?msg_id=25053445 > http://sourceforge.net/mailarchive/message.php?msg_id=21397763 > > > -Justin > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better > price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Semediawiki-user mailing list > Sem...@li... > https://lists.sourceforge.net/lists/listinfo/semediawiki-user > > |
From: Alex M. H. <amh...@on...> - 2011-02-02 10:19:46
|
Hi Justin, Sorry that didn't fully work out. The "OR" operator is described here: http://semantic-mediawiki.org/wiki/Help:Selecting_pages#Unions_of_query_results:_disjunctions || may be an option in your case, though, since you're just searching one property. Perhaps {{#ask: <q>[[String property::~*search value*]] OR [[string property::~*{{lc:search value}}*]] OR [[string property::~*{{uc:search value}}*]]</q>}} (or {{#ask: [[String property::~*search value*||~*{{lc:search value}}*|| ~*{{uc:search value}}*]], if you prefer to use ||) would work in most cases? The OR between the property values lets SMW know that you are asking for any one of the results (the default is requiring all of them to match the results). For mixed case strings, the following is a bit of a hack, but you may want to create a secondary property that creates a lower case or upper-case string value from the original property. This is best done through a template, e.g., [[String::{{{String property|}}}]] [[Search string::{{lc:{{{String property|}}}}}| ]] You can also do it via a #show: or #ask: (i.e., query the page for its own string value and pass that to the search string property), but that "solution" typically requires multiple saves (at least one extra) for the value to stick. Unless all your properties are set by non-substituted templates (in which case you just change the template as above), for existing data, this is a great job for pywikipediabot if you have command line access on your server. I'd highly recommend installing this if you can. It is sometimes a bit tricky to configure, but once you do, it is a very powerful tool. After installing it, you would do something like this: python replace.py -regex "(\[\[String::)(.*)(\]\])" "\1\2\3[[Search string::{{lc:\2}}| ]]" -start:! Or some variation thereof. I can never remember which special characters Python needs to have escaped, so you may need to fiddle with that a bit to get the right characters searched/replaced. It generally asks for confirmation, but be sure to do complete database and xml backups before you run it. Also, this will completely fail if you don't set a -start: value (i.e, the page from which to start replacing), so be sure to do that. Hope this helps, Alex ----Original Message----- From: Justin Keogh <jus...@gm...> To: Alex M. Hendler <amh...@on...> Cc: sem...@li... Subject: Re: [Semediawiki-user] Case-insensitive searching of SMW properties Date: Wed, 2 Feb 2011 01:45:23 -0700 I gave it a try and {{#ask: <q>[[String property::~*search value*]] OR [[string property::~*{{lc:search value}}*]]</q>}} omits pages with [[String Property::SEARCH VALUE]] in caps so it returns a different number of results than: {{#ask: <q>[[String property::~*SEARCH VALUE*]] OR [[string property::~*{{lc:SEARCH VALUE}}*]]</q>}} A couple things I dont understand... where does "OR" come from? It's difficult to search for "OR" and I cant find docs about "OR" on the #ask help pages.... also in: {{#ask: <q>[[String property::~*search value*]] OR [[string property::~*{{lc:search value}}*]]</q>}} that reads like it would match anything with "search value" in it or the lower case version of "search value" (unchanged in this example) but what about matching a page containing a property with the value "sEaRcH vALuE"? Thanks for the help! -Justin On Wed, Feb 2, 2011 at 1:14 AM, Alex M. Hendler <amh...@on...> wrote: Justin, The following should work: {{#ask: <q>[[String property::~*search value*]] OR [[string property::~*{{lc:search value}}*]]</q>}} If you're looking for exact matches, omit the asterisks. The {{lc: magic word is probably unnecessary, but I've found it helpful when searching for strings in the middle of other strings. I'm not sure how well this will work for form inputs, however. Also, AskQ looks like a really interesting extension, though, thanks for pointing that out! Hope this helps, Alex -- ontolawgy™ LLC: connect . . . the . . . dots™ http://ontolawgy.com From: Justin Keogh <jus...@gm...> To: sem...@li... Subject: [Semediawiki-user] Case-insensitive searching of SMW properties Date: Tue, 1 Feb 2011 23:08:14 -0700 Is it possible to search a string type property in a case-insensitive way? The normal MW full-page text search is case-insensitive, so I am using that for now, but I would like to do case in-sensitive searches on properties via SMW forms as well. I found: http://www.mediawiki.org/wiki/Extension:AskQ which appears to do case-insensitive searches, but I have been unable to get it to return results. two threads that mention case-insensitive searching: http://sourceforge.net/mailarchive/message.php?msg_id=25053445 http://sourceforge.net/mailarchive/message.php?msg_id=21397763 -Justin ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Semediawiki-user mailing list Sem...@li... https://lists.sourceforge.net/lists/listinfo/semediawiki-user |
From: Neill M. <ne...@nl...> - 2011-02-02 11:58:49
|
Hi. How hard would be it be to implement the option of making SMW queries case insensitive? It would be really useful. I have to do a lot of similar string manipulation to ensure words entered into runQuery's produce results. Biggest one is words at the start of a sentence being capitalised of course, but also peoples names, company names, counties, postal codes etc etc. Cheers Neill. On 02/02/11 09:48, Alex M. Hendler wrote: > Hi Justin, > > Sorry that didn't fully work out. The "OR" operator is described here: > > http://semantic-mediawiki.org/wiki/Help:Selecting_pages#Unions_of_query_results:_disjunctions > > || may be an option in your case, though, since you're just searching > one property. > > Perhaps > > {{#ask:<q>[[String property::~*search value*]] OR > [[string property::~*{{lc:search value}}*]] OR > [[string property::~*{{uc:search value}}*]]</q>}} > > (or {{#ask: [[String property::~*search value*||~*{{lc:search value}}*|| > ~*{{uc:search value}}*]], if you prefer to use ||) > > would work in most cases? > > The OR between the property values lets SMW know that you are asking for > any one of the results (the default is requiring all of them to match > the results). > > For mixed case strings, the following is a bit of a hack, but you may > want to create a secondary property that creates a lower case or > upper-case string value from the original property. This is best done > through a template, e.g., > > [[String::{{{String property|}}}]] > [[Search string::{{lc:{{{String property|}}}}}| ]] > > You can also do it via a #show: or #ask: (i.e., query the page for its > own string value and pass that to the search string property), but that > "solution" typically requires multiple saves (at least one extra) for > the value to stick. > > Unless all your properties are set by non-substituted templates (in > which case you just change the template as above), for existing data, > this is a great job for pywikipediabot if you have command line access > on your server. I'd highly recommend installing this if you can. It is > sometimes a bit tricky to configure, but once you do, it is a very > powerful tool. > > After installing it, you would do something like this: python replace.py > -regex "(\[\[String::)(.*)(\]\])" "\1\2\3[[Search string::{{lc:\2}}| ]]" > -start:! > > Or some variation thereof. I can never remember which special characters > Python needs to have escaped, so you may need to fiddle with that a bit > to get the right characters searched/replaced. It generally asks for > confirmation, but be sure to do complete database and xml backups before > you run it. Also, this will completely fail if you don't set a -start: > value (i.e, the page from which to start replacing), so be sure to do > that. > > Hope this helps, > Alex > > > ----Original Message----- > From: Justin Keogh<jus...@gm...> > To: Alex M. Hendler<amh...@on...> > Cc: sem...@li... > Subject: Re: [Semediawiki-user] Case-insensitive searching of SMW > properties > Date: Wed, 2 Feb 2011 01:45:23 -0700 > > I gave it a try and > > {{#ask:<q>[[String property::~*search value*]] OR [[string > property::~*{{lc:search value}}*]]</q>}} > > omits pages with [[String Property::SEARCH VALUE]] in caps > > so it returns a different number of results than: > > {{#ask:<q>[[String property::~*SEARCH VALUE*]] OR [[string > property::~*{{lc:SEARCH VALUE}}*]]</q>}} > > A couple things I dont understand... where does "OR" come from? It's > difficult to search for "OR" and I cant find docs about "OR" on the #ask > help pages.... > > also in: > > {{#ask:<q>[[String property::~*search value*]] OR [[string > property::~*{{lc:search value}}*]]</q>}} > > that reads like it would match anything with "search value" in it or the > lower case version of "search value" (unchanged in this example) but > what about matching a page containing a property with the value "sEaRcH > vALuE"? > > Thanks for the help! -Justin > > > > > > On Wed, Feb 2, 2011 at 1:14 AM, Alex M. Hendler > <amh...@on...> wrote: > Justin, > > The following should work: > > {{#ask:<q>[[String property::~*search value*]] OR [[string > property::~*{{lc:search value}}*]]</q>}} > > If you're looking for exact matches, omit the asterisks. The > {{lc: magic > word is probably unnecessary, but I've found it helpful when > searching > for strings in the middle of other strings. > > I'm not sure how well this will work for form inputs, however. > > Also, AskQ looks like a really interesting extension, though, > thanks for > pointing that out! > > Hope this helps, > Alex > > > -- > ontolawgy™ LLC: connect . . . the . . . dots™ > http://ontolawgy.com > > > From: Justin Keogh<jus...@gm...> > To: sem...@li... > Subject: [Semediawiki-user] Case-insensitive searching of SMW > properties > Date: Tue, 1 Feb 2011 23:08:14 -0700 > > > Is it possible to search a string type property in a > case-insensitive way? > > The normal MW full-page text search is case-insensitive, so I am > using that > for now, but I would like to do case in-sensitive searches on > properties via > SMW forms as well. > > I found: http://www.mediawiki.org/wiki/Extension:AskQ which > appears to do > case-insensitive searches, but I have been unable to get it to > return > results. > > two threads that mention case-insensitive searching: > http://sourceforge.net/mailarchive/message.php?msg_id=25053445 > http://sourceforge.net/mailarchive/message.php?msg_id=21397763 > > > -Justin > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD > value)! > Finally, a world-class log management solution at an even better > price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Semediawiki-user mailing list > Sem...@li... > https://lists.sourceforge.net/lists/listinfo/semediawiki-user > > > > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Semediawiki-user mailing list > Sem...@li... > https://lists.sourceforge.net/lists/listinfo/semediawiki-user |