From: AG <gru...@gm...> - 2020-12-07 11:05:11
|
First of all, Hello everybody! I'm new here and very excited to be on this list! Here is my problem. After reading XQuery and eXist-db documentations, I can't figure it out, so I decided to ask the question here. *In a nutshell:* The fulltext search with KWIC doesn't work if the variable in the path for fulltext search was put in a tag in preceding "result". It returns an empty result. *Explanations: * *XML file* > <root> > <node>blablabla</node> > <node>blab KEYWORD labla</node> > <node>blablabla</node></root> > > *Index configuration (collection.xconf)* > <collection xmlns="http://exist-db.org/collection-config/1.0"> > <index xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <lucene> > <text qname="root"/> > <text qname="node"/> > </lucene> > </index></collection> > > *XQuery without "tagged" result (it works)* *(look at "return $node")* > let $my_texts := > for $node in collection("path_to_my_collection")//node > return > $node > > for $my_hit in $my_texts[ft:query(., "KEYWORD")] > return > $my_hit > > The Xquery code above works and I get a result. > 1<node>blab KEYWORD labla</node> > > But it doesn't work when the first result on which fulltext search is launched was put in a tag. (My whole query is more complex and I need to put this result in the tag to use it in another place of my code.) *XQuery with "tagged" result (it doesn't work)* *(look at "return <tag>{$node}</tag>")* > let $my_texts := > for $node in collection("path_to_my_collection")//node > return > <tag>{$node}</tag> > > for $my_hit in $my_texts[ft:query(., "KEYWORD")] > return > $my_hit > > This query return 0 result. When I debug like this: *XQuery for debugging* > let $my_texts := > for $node in collection("path_to_my_collection")//node > return > <tag>{$node}</tag> > > return > $my_texts > > I get this: > 1<tag> > <node>blablabla</node></tag> > > 2<tag> > <node>blab KEYWORD labla</node></tag> > > 3<tag> > <node>blablabla</node></tag> > > What I tried: - different path combinations: $my_texts/tag[ft:query(., "KEYWORD")], $my_texts/tag/node[ft:query(., "KEYWORD")], $my_texts/*[ft:query(., "KEYWORD")], $my_texts/tag//*[ft:query(., "KEYWORD")], $my_texts//*//*[ft:query(., "KEYWORD")] etc... - add <tag> in the Index configuration (<text qname="tag"/>) What I missed? Or it is an eXist-db bug? (my eXist version: 4.7.0) Many thanks in advance for all your help! Sincerely, AG. |