1

I'm running a clean exist-db 4.5.0 on MacOS. Just installed the "shakespeare" package for testing. When im running the following request via browser I get no hits. But the he5.xml is a valid TEI file and contains in the body one text element.

http://127.0.0.1:8080/exist/rest/apps/shakespeare/data/he5.xml?_query=//text

<exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist" exist:hits="0" exist:start="1" exist:count="0" exist:compilation-time="0" exist:execution-time="0"/>

Using Basic Auth credentials (user: admin, password: EMPTY) in URL doesn't change anything. http://admin:@127.0.0.1:8080/exist/rest/apps/shakespeare/data/he5.xml?_query=//text

Only the //* XPATH seems to work (or getting ignored?) because I'm getting the whole content of the file. Other requests don't work either (correctly). Like the //text() xquery:

<exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist" exist:hits="10313" exist:start="1" exist:count="10" exist:compilation-time="1" exist:execution-time="1">
The Life of King Henry the Fifth William Shakespeare Craig A. Berry, Martin Mueller, and Clifford Wulfman
</exist:result>

This is just the first hit of text...

Tried this also on Ubuntu with exist-db 4.4.0... same "result".

zypro
  • 1,158
  • 3
  • 12
  • 33

1 Answers1

0

I think you have made a mistake in your query. You state that you tried:

http://127.0.0.1:8080/exist/rest/apps/shakespeare/data/he5.xml?_query=//text

That query tries to find all elements named text. I think you probably wanted to just get all the text nodes, so you would instead need:

http://127.0.0.1:8080/exist/rest/apps/shakespeare/data/he5.xml?_query=//text()

Note the additional ().

Also I think your URL path looks suspect too, if you are trying to use the REST API then you should use the full database collection path, i.e.:

    http://127.0.0.1:8080/exist/rest/db/apps/shakespeare/data/he5.xml?_query=//text()

Note the additional /db.

adamretter
  • 3,885
  • 2
  • 23
  • 43
  • Thx for your answer, but I know the difference between `text` and `text()`. But none of them returned the expected/correct result. Also the additional `/db` doesn't made a difference... – zypro Nov 23 '19 at 16:35