Am 14.01.2012 um 00:50 schrieb Christian Grün:
And now everything runs smoothly: I had to use the bigger machine for creating and indexing the collection (now consisting of 677 documents with 1.9 GB input size resulting in a 2.1 GB collection).
Fine; does it mean that the index is now recognized by the optimizer?
It's a bit strange: I tried to index and re-index and remove the index etc. with BaseX 7.0.2 several times -- not changing my original query -- and one time out of maybe 20 the index was used. Then I switched to BaseX 7.1 and without changing anything, the index is used always. I tried Linux CenOS and Mac OSX with the same result.
I would be interested -- mainly for development and debugging -- to access information concerning query processing (i.e., information displayed in the "Query Info" buffer in the gui) with the client. I use the Perl API.
That can be done by activating the QUERYINFO option and calling info(). A little example:
print $session->execute("set queryinfo on")."\n"; ... print $session->execute("xquery 1")."\n"; print $session->info()."\n"; ...
I have to admit, I don't quite get it and I didn't find relevant things in the examples.
The usecase is this: The user types something in a textfield, which is then used as querytext -- I will extend this part to allow users to select several options, but for now it's only one. As a result I would like to see - the number of results - the time needed for executing the query and - the results themselves (preferable one by one for adding additional information, reformating, etc., later I will add a second application to annotate each match and update the collection)
Here is my example code used on http://oldphras.unibas.ch/cgi-bin/basex-client.pl:
if ($querytext) { eval { # create session my $session = Session->new("localhost", 1984, "admin", "admin"); # open database $session->execute("open Digibib-DTA"); print $session->info()."\n"; # create query instance $querytext = 'declare default element namespace "http://www.tei-c.org/ns/1.0"; ft:mark(//*[text() contains text "'.$querytext.'" using stemming using language "de"][self::p or self::l])'; my $xquery = $session->query($querytext);
# loop through all results my $count = 0; while ($xquery->more()) { $count++; my $find = $xquery->next(); $find =~ s/</mark>(\s*)<mark.*?>/$1/g; print "<div><b>$count</b>: ".$find."</div>\n"; }
# close query $xquery->close(); # close session $session->close(); }; }
I tried 'print $xquery->info(), but this seems to work with execute() only, not with more().
$session->execute("set queryinfo on"); my $xquery = $session->query($querytext); print $xquery->execute(); print $xquery->info();
I would be very thankful for any hint.
Is there a possibility to store the namespace information somewhere else and not have to write it into every query?
Best regards
Cerstin