Fulltext query: values in some elements are not indexed?
Monday, 10 March 2014 · 5 messages
IK
Ioannis Kavvouras10 Mar 2014 10:52 #
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
YannisCG
Christian Grün10 Mar 2014 10:54 #
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
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
IK
Ioannis Kavvouras10 Mar 2014 11:03 #
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
CG
Christian Grün10 Mar 2014 11:14 #
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
[1] http://docs.basex.org/wiki/Options#CHOP
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 > >
IK
Ioannis Kavvouras10 Mar 2014 11:21 #
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.
⚡Generated with XQuery