Fulltext query: values in some elements are not indexed?
We query on fulltext an xml file. After some experiments we found out that if the "terms" are in the middle of the text-element the 'ft:contains' returns true.
On the other hand, if the query is the whole text-element it returns false. ie.
<ows:IndividualName>FirstName LastName</ows:IndividualName>
the query
-------- query --------
for $r in /server
where
ft:contains($r, ( 'FirstName' , 'LastName' ), <options><fuzzy value="true"/><mode value='any'/></options>)
return $r
--- end of query ---
returns an empty set. In addition, queries with fuzzy value equal to false or true and mode value phrase return also an empty set.
Regards Yannis
Hi Ioannis,
could you please provide us with a fully working example?
If you work with mixed content, you could as well have a look at our documentation [1].
Best, Christian
Quoted text · Ioannis Kavvouras · 27 lines
On Mon, Mar 10, 2014 at 10:52 AM, Ioannis Kavvouras <i.kavvouras at di.uoa.gr> wrote: > We query on fulltext an xml file. After some experiments we found out that > if the "terms" are in the middle of the text-element the 'ft:contains' > returns true. > On the other hand, if the query is the whole text-element it returns false. > ie. > <ows:IndividualName>FirstName LastName</ows:IndividualName> > > the query > -------- query -------- > for $r in /server > where > ft:contains($r, ( 'FirstName' , 'LastName' ), <options><fuzzy > value="true"/><mode value='any'/></options>) > return $r > --- end of query --- > returns an empty set. In addition, queries with fuzzy value equal to false > or true and mode value phrase return also an empty set. > > > Regards > Yannis > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hello Christian, Thank you for the quick reply.
This is the document I am trying to query: http://ariadni.di.uoa.gr:8181/BaseX78/rest/wcs-collection/bgs.xml it's not mixed.
if the terms are: "services for the" it returns results... if the terms are "John Laxton", it will return an empty set.
Regards, Yannis
Quoted text · Christian Grün · 41 lines
On 03/10/2014 11:54 AM, Christian Grün wrote: > Hi Ioannis, > > could you please provide us with a fully working example? > > If you work with mixed content, you could as well have a look at our > documentation [1]. > > Best, > Christian > > [1] http://docs.basex.org/wiki/Full-Text#Mixed_Content > > > On Mon, Mar 10, 2014 at 10:52 AM, Ioannis Kavvouras > <i.kavvouras at di.uoa.gr> wrote: >> We query on fulltext an xml file. After some experiments we found out that >> if the "terms" are in the middle of the text-element the 'ft:contains' >> returns true. >> On the other hand, if the query is the whole text-element it returns false. >> ie. >> <ows:IndividualName>FirstName LastName</ows:IndividualName> >> >> the query >> -------- query -------- >> for $r in /server >> where >> ft:contains($r, ( 'FirstName' , 'LastName' ), <options><fuzzy >> value="true"/><mode value='any'/></options>) >> return $r >> --- end of query --- >> returns an empty set. In addition, queries with fuzzy value equal to false >> or true and mode value phrase return also an empty set. >> >> >> Regards >> Yannis >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
If all of the terms you are looking for occur in the same text node, you can try the following query:
for $r in /server
where ft:contains($r//text(), ( 'John Laxton' ))
return $rAs an alternative, you can to deactivate whitespace chopping before creating a document [1]. Otherwise, empty text nodes will be removed from your document, and your text nodes will be merged. This is demonstrated by the following two queries:
ft:contains(<a>A<b>X</b></a>, 'A')
ft:contains(<a>A<b>X</b></a>, 'AX')Hope this helps, Christian
Quoted text · Ioannis Kavvouras · 66 lines
On Mon, Mar 10, 2014 at 11:03 AM, Ioannis Kavvouras <i.kavvouras at di.uoa.gr> wrote: > Hello Christian, > Thank you for the quick reply. > > This is the document I am trying to query: > http://ariadni.di.uoa.gr:8181/BaseX78/rest/wcs-collection/bgs.xml > it's not mixed. > > if the terms are: "services for the" it returns results... if the terms are > "John Laxton", it will return an empty set. > > Regards, > Yannis > > > > > On 03/10/2014 11:54 AM, Christian Grün wrote: >> >> Hi Ioannis, >> >> could you please provide us with a fully working example? >> >> If you work with mixed content, you could as well have a look at our >> documentation [1]. >> >> Best, >> Christian >> >> [1] http://docs.basex.org/wiki/Full-Text#Mixed_Content >> >> >> On Mon, Mar 10, 2014 at 10:52 AM, Ioannis Kavvouras >> <i.kavvouras at di.uoa.gr> wrote: >>> >>> We query on fulltext an xml file. After some experiments we found out >>> that >>> if the "terms" are in the middle of the text-element the 'ft:contains' >>> returns true. >>> On the other hand, if the query is the whole text-element it returns >>> false. >>> ie. >>> <ows:IndividualName>FirstName LastName</ows:IndividualName> >>> >>> the query >>> -------- query -------- >>> for $r in /server >>> where >>> ft:contains($r, ( 'FirstName' , 'LastName' ), <options><fuzzy >>> value="true"/><mode value='any'/></options>) >>> return $r >>> --- end of query --- >>> returns an empty set. In addition, queries with fuzzy value equal to >>> false >>> or true and mode value phrase return also an empty set. >>> >>> >>> Regards >>> Yannis >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
Quoted text · Christian Grün · 3 lines
> for $r in /server > where ft:contains($r//text(), ( 'John Laxton' )) > return $r
this worked in all cases :)
Thank you Yannis
Quoted text · Christian Grün · 86 lines
On 03/10/2014 12:14 PM, Christian Grün wrote: > If all of the terms you are looking for occur in the same text node, > you can try the following query: > > for $r in /server > where ft:contains($r//text(), ( 'John Laxton' )) > return $r > > As an alternative, you can to deactivate whitespace chopping before > creating a document [1]. Otherwise, empty text nodes will be removed > from your document, and your text nodes will be merged. This is > demonstrated by the following two queries: > > ft:contains(<a>A<b>X</b></a>, 'A') > ft:contains(<a>A<b>X</b></a>, 'AX') > > Hope this helps, > Christian > > [1] http://docs.basex.org/wiki/Options#CHOP > > > > On Mon, Mar 10, 2014 at 11:03 AM, Ioannis Kavvouras > <i.kavvouras at di.uoa.gr> wrote: >> Hello Christian, >> Thank you for the quick reply. >> >> This is the document I am trying to query: >> http://ariadni.di.uoa.gr:8181/BaseX78/rest/wcs-collection/bgs.xml >> it's not mixed. >> >> if the terms are: "services for the" it returns results... if the terms are >> "John Laxton", it will return an empty set. >> >> Regards, >> Yannis >> >> >> >> >> On 03/10/2014 11:54 AM, Christian Grün wrote: >>> Hi Ioannis, >>> >>> could you please provide us with a fully working example? >>> >>> If you work with mixed content, you could as well have a look at our >>> documentation [1]. >>> >>> Best, >>> Christian >>> >>> [1] http://docs.basex.org/wiki/Full-Text#Mixed_Content >>> >>> >>> On Mon, Mar 10, 2014 at 10:52 AM, Ioannis Kavvouras >>> <i.kavvouras at di.uoa.gr> wrote: >>>> We query on fulltext an xml file. After some experiments we found out >>>> that >>>> if the "terms" are in the middle of the text-element the 'ft:contains' >>>> returns true. >>>> On the other hand, if the query is the whole text-element it returns >>>> false. >>>> ie. >>>> <ows:IndividualName>FirstName LastName</ows:IndividualName> >>>> >>>> the query >>>> -------- query -------- >>>> for $r in /server >>>> where >>>> ft:contains($r, ( 'FirstName' , 'LastName' ), <options><fuzzy >>>> value="true"/><mode value='any'/></options>) >>>> return $r >>>> --- end of query --- >>>> returns an empty set. In addition, queries with fuzzy value equal to >>>> false >>>> or true and mode value phrase return also an empty set. >>>> >>>> >>>> Regards >>>> Yannis >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>
Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.