Erik Moeller wrote:
See my CVS commit comment and the Namespace.php docs
for further detail.
There's still quite a bit of coding, hacking and testing to do, but I
anticipate finalizing the first milestone in the coming days. This will
also include a design whitepaper for the Wikidata table design, and some
GUI demos.
A couple DB-related notes on my first quick readthrough:
# Pseudo-namespaces (title prefixes)
$match = $dbs->addQuotes($name.":%");
$res = $dbs->select(
'page',
array('page_title'),
array('page_title LIKE '.$match),
$fname,
array('LIMIT'=>1)
);
Two things you probably want to do here are to add a clause
'page_namespace' => 0 (otherwise it may end up an unindexed table scan
which will be *very* slow and may get false matches on non-main
namespaces), and to escape any _ or % chars in the name for that LIKE match.
If we don't already have a public function for LIKE escaping we probably
should add one and use that consistently.
$match=$dbs->addQuotes("%[[$name:%");
# Query needs to be optimized/simplified,
# but will generally be run very rarely.
$res = $dbs->select(
array('page', /* FROM */
'pagelinks',
'revision',
'text'),
array('DISTINCT page_title',
'page_namespace'),
array('pl_namespace='.$index,
'page_id=pl_from',
'rev_id=page_latest',
'rev_text_id=old_id',
'old_text like '.$match),
array('LIMIT'=>1)
I'm afraid this one just isn't going to work at all... Text entries in
text.old_text will often be either compressed or indirection records
pointing to the secondary text storage cluster. You also have the issues
of case sensitivity, spaces vs underscores, etc.
From now on, I will commit more often -- this is
important, I think, to
ensure that people see that work is being done.
Cool!
-- brion vibber (brion @
pobox.com)