Re: [trunk regression]: util:expand() throws *start offset* out of bounds exception after recent commits
Hungerburg <pch13 <at> myzel.net>
2011-02-01 11:17:42 GMT
Am 2011-02-01 10:26, schrieb Ron Van den Branden:
> I tried tocook up a XQuery Unit test file from your test case, but failed to
> trigger the error. Could you perhaps pass on the actual queries that
> do/n't produce the errors?
Hello Ron,
the lines a, b in the query, that fetches and displays lucene search
results produce the error, I have to yank both to make the query pass:
let $hits := collection($coll)//foo[ft:query-field("bar", $query)]
for $hit in $hits
a) let $expanded := kwic:expand($hit)
b) { kwic:summarize($hit, <config width="40"/>) }
the error only happens, when the document, where the hit occurs, has
empty elements above the location of the hit, and only if the string
that produces the hit should have the hilight start at the beginning of
the xml-element, that contains the string. This works reliably.
It looks to me like util:expand and some other function, or even
util:expand itself, treat empty elements differently when counting
offsets: either one or zero chars. If there is one empty element before
the search hit, then (when the hit should start in the middle of a
string from an element) the hilight will be off by one to the left, if
two then two, etc. so it may become less than 0 if it hits somewhere
later in the document?
The stack trace starts like that:
> 2011-02-01 11:51:02,509 [eXistThread-24] DEBUG (Expand.java [eval]:97) - Setting serialization
property: expand-xincludes = no
> 2011-02-01 11:51:02,510 [eXistThread-24] DEBUG (LuceneMatchListener.java [scanMatches]:205) -
Analyzer: org.apache.lucene.analysis.de.GermanAnalyzer <at> 4a415b46 for path: /produkt
> 2011-02-01 11:51:02,511 [eXistThread-24] DEBUG (RESTServer.java [doGet]:484) - start offset out of
bounds [at line 216, column 5, source: jar:file:/opt/eXist/exist.jar!/org/exist/xquery/lib/kwic.xql]
> In function:
> kwic:expand(element()) [63:42:jar:file:/opt/eXist/exist.jar!/org/exist/xquery/lib/kwic.xql]
> org.exist.xquery.XPathException: start offset out of bounds [at line 216, column 5, source: jar:file:/opt/eXist/exist.jar!/org/exist/xquery/lib/kwic.xql]
> In function:
> kwic:expand(element()) [63:42:jar:file:/opt/eXist/exist.jar!/org/exist/xquery/lib/kwic.xql]
> at org.exist.xquery.functions.util.Expand.eval(Expand.java:116)
> at org.exist.xquery.BasicFunction.eval(BasicFunction.java:68)
> at org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:55)
Yours
--
--
peter
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d