0
votes

I have an issue with running an XQuery on eXist-db. I have an application that runs on Tomcat and sends queries to eXist-db, to find certain files. The query that is generated and sent is like this (I use ~ for fuzzy search):

for $doc in collection('/db')//document/sender[ft:query(.,'test~')] 
let $score := ft:score($doc)
order by $score descending
return
    base-uri($doc)

and I get the following error on the test server:

 org.exist.xquery.XPathException: exerr:ERROR Syntax error in Lucene query
 string: Cannot parse 'test~': Encountered " <FUZZY_SLOP> "~ "" at line 1, column 10.
Was expecting one of:
    <EOF>
    <AND> ...
    <OR> ...
    <NOT> ...
    "+" ...
    "-" ...
    <BAREOPER> ...
    "(" ...
    "*" ...
    "^" ...
    <QUOTED> ...
    <TERM> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    <REGEXPTERM> ...
    "[" ...
    "{" ...
    <NUMBER> ...

However, when I run the same query on my local machine, I do not get that error and instead I get the expected results. What am I missing?

1
What is the version of eXist on each machine? - Joe Wicentowski
It is the same. The latest stable(2.2). - Milan Todorovic
Very strange. I definitely wouldn't expect to see this error in 2.2. Could you try reindexing the collection in question on the machine where you're having the problem? If your index is defined on /db, then: xmldb:reindex('/db'). See if this helps. - Joe Wicentowski

1 Answers

1
votes

I fear that there is some very subtle difference between the query that your application is sending to eXist-db, and the query when you run it on a local eXist-db instance.

I also made a couple minor cleanups to your query above.