the || disjunction operator in semantic search breaks page
Closed, ResolvedPublic


Author: info

Pages that use || in semantic searches return a blank page (0-length HTML, no

This happened fairly recently on

It makes pages like (an unofficial help
page) appear blank.

Yet the documentation says
that || is the right way to require a disjunction.

You can see it if you go to
and query for [[Born in::Dallas||Iceland]]

Remove one of the terms and it works.

Version: unspecified
Severity: major
URL:[[Born in::Dallas||Iceland]]


bzimport created this task.Mar 6 2007, 6:15 AM

info wrote:

On my local wiki, I get
Catchable fatal error: Object of class Title could not be converted to string in
on line 831

$check_titles = array_diff( $titles , array() ); // Copies the array

According to the doc at,
array_diff() casts to string when comparing array entries, and this fails for
MediaWiki's Title objects.

I think this broke in revision 17529 when normalizeRedirects() switched from
working on article names to working on Title objects.

Maybe there's a better way to copy the $titles array with the desired behavior.
(I think array_unique() is a better function to use here and elsewhere than
array_diff() but it too casts to a string.)

Or, create a $check_title_article_ids array just with the title->getArticleID()s
and iterate through that; but the code is complex.
I think the code is also broken at line 850

		if (!array_key_exists( $id , $titles)) {

where it assumes a title's articleID is the key for title objects in an array.

A workaround is to disable redirect normalization by setting
$smwgIQRedirectNormalization = false; in the file.

I think I fixed this one for now (at least [[Born in::Dallas||Iceland]] works,
and I addressed the issue with title keys). Future versions will get a better
redirect handling.

Add Comment