[Mediawiki-l] mediawiki 1.4 & 1.5rc4, substring search, how?

Coombes, Andrew andrew.coombes at hants.gov.uk
Tue Sep 27 08:40:24 UTC 2005


Thanks guys,

Both versions work really well, feedback from users is excellent.  The * also works as the fourth char in the search string.  No adverse problems so far.

Regards,

Andrew

MediaWiki: 1.4.5 
PHP: 4.3.10 (cgi) 
MySQL: 4.0.25-standard-log


-----Original Message-----
From: mediawiki-l-bounces at Wikimedia.org
[mailto:mediawiki-l-bounces at Wikimedia.org]On Behalf Of Maurice Joseph
Sent: 23 September 2005 17:50
To: mediawiki-l at wikimedia.org
Subject: RE: [Mediawiki-l] mediawiki 1.4 & 1.5rc4, substring search,
how?


Andrew;

Yes.

function legalSearchChars() {
	return "A-Za-z_'*0-9\\x80-\\xFF\\-";
}

It looks like this string is treated as a class in a regular expression in the 
filter function.

It would be more practical to parameterize this is DefaultSettings.php for 
those who wish to modify without changing code.

Let me know if you encounter any side affects.

Maurice Joseph
SpikeSource, Inc.
developer.spikesource.com


> Hi Maurice,
> 
> Looks really useful, do we place the "*" in this function:
> 
> 	function legalSearchChars() {
> 		return "A-Za-z_'0-9\\x80-\\xFF\\-";
> 	}
> 
> If so where and how, otherwise, which one please.
> 
> Thanks,
> 
> Andrew
> 
> -----Original Message-----
> From: mediawiki-l-bounces at Wikimedia.org
> [mailto:mediawiki-l-bounces at Wikimedia.org]On Behalf Of Maurice Joseph
> Sent: 22 September 2005 22:06
> To: mediawiki-l at wikimedia.org
> Subject: RE: [Mediawiki-l] mediawiki 1.4 & 1.5rc4, substring search,
> how?
> 
> 
> Did a little experimenting on my local install and here's my findings. Note, 

> I'm using mysql db.
> 
> Enabling the following debug flags helps display the pertinent content:
> $wgDebugComments        = true;
> $wgDebugDumpSql         = true;
> 
> Under ../includes/SearchMySQL.php contains the following function:
> 
> function searchText( $term ) {
>       $resultSet = $this->db->resultObject( $this->db->query( 
$this->getQuery( 
> $this->filter( $term ), true ) ) );
>       return new MySQLSearchResultSet( $resultSet, $this->searchTerms );
> }
> 
> Basically, filter() (in SearchEngine.php) defines what is a legal character. 

> Modify this constant to allow '*'. Now wildcards matches work.
> 
> Also, see http://dev.mysql.com/doc/mysql/en/fulltext-boolean.html for 
details 
> about full text sql queries in MySQL. 
> 
> Maurice Joseph
> SpikeSource
> developer.spikesource.com
> 
> 
> 
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l at Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l


More information about the MediaWiki-l mailing list