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

Maurice Joseph teamspike at spikesource.com
Fri Sep 23 16:50:01 UTC 2005


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



More information about the MediaWiki-l mailing list