Adam R. B. Jack wrote:
Please forgive me if this is my XPATH inexperience, but I'm feeding documents into a collection, and then am unable to access them via XPATH, either "xindice xpath" command line, or code (from Example1).
I have documents like this in a collection:
<feed ... <link <entry... <link ...
and I have tried queries like:
//feed
//feed/entry
//link[rel='alternate']
/feed, /feed/entry, etc, will work faster as you can read in parallel thread.
.. and I get 0 results. I do //* and I get bucket loads (and out of memory
in Eclipse) which is understandable, I guess.
"//*" is really nasty xpath. Don't do it.
F:\data\OSS>xindice xpath -c /db/atom -q "//link[rel='alternate']" [DEBUG] DatabaseImpl - -Using SAX Driver: 'xerces' [DEBUG] DatabaseImpl - -Using Service Location: '/xindice/' [DEBUG] CollectionImpl - -Using URL: 'http://127.0.0.1:8888/xindice/'
No results. Also:
F:\data\OSS>xindice xpath -c /db/atom -q //feed [DEBUG] DatabaseImpl - -Using SAX Driver: 'xerces' [DEBUG] DatabaseImpl - -Using Service Location: '/xindice/' [DEBUG] CollectionImpl - -Using URL: 'http://127.0.0.1:8888/xindice/'
gives debug looking like:
[DEBUG] Collection - -[PoolThread-4] '/db/atom' Query collection, query //feed [DEBUG] Collection - -[PoolThread-4] '/db/atom' Get document: 00ffa7c06645793300 0000fa3f3918c3 [...] [DEBUG] Collection - -[PoolThread-4] '/db/atom' Get document: 00ffa7c06645793300 0000fa4111471c
... and nothing else.
Try other commands first, like lc, ld, rd. Following commands work ok for me:
bin\xindice ld -c /db/system/SysConfig
bin\xindice rd -c /db/system/SysConfig -n database.xml
bin\xindice xpath -c /db/system/SysConfig -q "/database"
I think I'm just downloading the XML and stuffing it in the DB, when I printed the contents they looked sure right.
So, any pointers on how I debug this? Am I missing some indexing or something,
No, you don't need no indexers to perform queries. You need indexes only when everything is working, but slow ;-)
can I get inside this problem with code or tools or debug config?
General comments about logging.
Before starting xindice using "xml-xindice/xindice.bat" script, you can set variable:
set JAVA_OPTIONS=-Dorg.apache.commons.logging.simplelog.defaultlog=TRACE -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
to turn on TRACE log level.
When using command line client, CVS version, you can simply set LOGLEVEL: set LOGLEVEL=TRACE
Vadim
