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.
Good to hear that the problems are resolved in the latest version.
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.
No problem, I'll try to give some more details: by executing the QUERYINFO option [1], you get detailed information on the query process, such as the compilation steps or the number of results. If you only want to know the time needed for evaluating the query, you can call $session-info() or $query-info() without setting the option mentioned above.
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)
The attached perl client may give you the requested results. It creates the result representation directly within XQuery. This way, you'll get better performance, and may be more flexible when working with the evaluated results. Next, I'm also using $xquery->bind() for assigning the query terms, as this reduces the danger of risky query strings (e.g. including quotes) that could break your query.
I tried 'print $xquery->info(), but this seems to work with execute() only, not with more().
True, $xquery->info() won't give you the compilation steps. In future, we may include an extra databae command that does nothing else than returning information on query execution.
Is there a possibility to store the namespace information somewhere else and not have to write it into every query?
Currently, the easiest way is to use wildcards instead of explicitly specifying the namespace. (... /*:element).
Hope this helps, Christian