BaseX ordered results?
Saturday, 24 June 2017 · 4 messages
BV
Bram Vanroy24 Jun 2017 14:09 #
Dear list
We were wondering if BaseX always returns the results in the same order, even when using an XQUERY position(). In other words, if we only request the first 10 results as defined by position(), will this *always* be the same results, or is it possible that each time it will be ten different results? Or will caching and indexing alter the way in which results are returned first?
Thank you in advance
Bram Vanroy
https://bramvanroy.be
XS
Xavier-Laurent SALVADOR24 Jun 2017 16:03 #
Hi Bram,
Here is my experience : for what I saw in all our dictionnaries, the process order is always the same. I thought it was due to the ordered index structure.
If you look at http://temp.biblehistoriale.fr/rubrique/G/1 , you will see that order and results are always the same.
Code for extracting dictionary index is:
let $indice := (POST variable)
for $i at $position in db:open($isi:bdd)/root/fiche
[some $o in entry/form/orth satisfies matches($o,concat('^',$l),'i')]
where $position gt xs:integer($indice) and $count lt
xs:integer($indice) + 9
order by xs:dateTime($i/creationDate) descending
return
$iSo I think that means that position() is stable.
2017-06-24 14:09 GMT+02:00 Bram Vanroy <bram.vanroy1 at student.kuleuven.be>:
Quoted text · Bram Vanroy · 25 lines
> Dear list > > > > We were wondering if BaseX always returns the results in the same order, > even when using an XQUERY position(). In other words, if we only request > the first 10 results as defined by position(), will this **always** be > the same results, or is it possible that each time it will be ten different > results? Or will caching and indexing alter the way in which results are > returned first? > > > > > > Thank you in advance > > > > Bram Vanroy > > https://bramvanroy.be > > >
--
Ce message peut contenir des informations réservées exclusivement à son destinataire. Toute diffusion sans autorisation est interdite. Si vous n'en êtes pas le destinataire, merci de prendre contact avec l'expéditeur et de détruire ce message.
*This email may contain material for the sole use of the intended recipient. Any forwarding without express permission is prohibited. If you are not the intended recipient, please contact the sender and delete all copies*.
KK
Kristian Kankainen24 Jun 2017 18:24 #
Items returned by path expressions will always be in document order as I understood the specs.
24. juuni 2017 5:03 PM kirjutas kuupäeval Xavier-Laurent SALVADOR <xavierlaurent.salvador at gmail.com>:
Quoted text · Xavier-Laurent SALVADOR · 47 lines
> Hi Bram, > > > Here is my experience : for what I saw in all our dictionnaries, the process order is always the same. I thought it was due to the ordered index structure. > > > If you look at http://temp.biblehistoriale.fr/rubrique/G/1 , you will see that order and results are always the same. > > > Code for extracting dictionary index is: > > > let $indice := (POST variable) > for $i at $position in db:open($isi:bdd)/root/fiche > [some $o in entry/form/orth satisfies matches($o,concat('^',$l),'i')] > where $position gt xs:integer($indice) and $count lt xs:integer($indice) + 9 > order by xs:dateTime($i/creationDate) descending > return > $i > > > So I think that means that position() is stable. > > > > > 2017-06-24 14:09 GMT+02:00 Bram Vanroy <bram.vanroy1 at student.kuleuven.be>: > > > Dear list > > > > We were wondering if BaseX always returns the results in the same order, even when using an XQUERY position(). In other words, if we only request the first 10 results as defined by position(), will this *always* be the same results, or is it possible that each time it will be ten different results? Or will caching and indexing alter the way in which results are returned first? > > > > > > Thank you in advance > > > > Bram Vanroy > > https://bramvanroy.be > > > > > > > > -- > Ce message peut contenir des informations réservées exclusivement à son destinataire. Toute diffusion sans autorisation est interdite. Si vous n'en êtes pas le destinataire, merci de prendre contact avec l'expéditeur et de détruire ce message. > > This email may contain material for the sole use of the intended recipient. Any forwarding without express permission is prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
XS
Sorry List, here is the right text è_è :
let $indice := (POST variable)
let $l := (POST variable)
for $i at $position in db:open($isi:bdd)/root/fiche
[some $o in entry/form/orth satisfies matches($o,concat('^',$l),'i')]
where $position gt xs:integer($indice) and $indice lt
xs:integer($indice) + 9
order by xs:dateTime($i/creationDate) descending
return
$i
--> index still the same2017-06-24 16:03 GMT+02:00 Xavier-Laurent SALVADOR <
xavierlaurent.salvador at gmail.com>:
Quoted text · Xavier-Laurent SALVADOR · 63 lines
> Hi Bram, > > Here is my experience : for what I saw in all our dictionnaries, the > process order is always the same. I thought it was due to the ordered index > structure. > > If you look at http://temp.biblehistoriale.fr/rubrique/G/1 , you will see > that order and results are always the same. > > Code for extracting dictionary index is: > > let $indice := (POST variable) > for $i at $position in db:open($isi:bdd)/root/fiche > [some $o in entry/form/orth satisfies matches($o,concat('^',$l),'i')] > where $position gt xs:integer($indice) and $count lt > xs:integer($indice) + 9 > order by xs:dateTime($i/creationDate) descending > return > $i > > So I think that means that position() is stable. > > 2017-06-24 14:09 GMT+02:00 Bram Vanroy <bram.vanroy1 at student.kuleuven.be>: > >> Dear list >> >> >> >> We were wondering if BaseX always returns the results in the same order, >> even when using an XQUERY position(). In other words, if we only request >> the first 10 results as defined by position(), will this **always** be >> the same results, or is it possible that each time it will be ten different >> results? Or will caching and indexing alter the way in which results are >> returned first? >> >> >> >> >> >> Thank you in advance >> >> >> >> Bram Vanroy >> >> https://bramvanroy.be >> >> >> > > > > -- > Ce message peut contenir des informations réservées exclusivement à son > destinataire. Toute diffusion sans autorisation est interdite. Si vous > n'en êtes pas le destinataire, merci de prendre contact avec l'expéditeur > et de détruire ce message. > > *This email may contain material for the sole use of the intended > recipient. Any forwarding without express permission is prohibited. If you > are not the intended recipient, please contact the sender and delete all > copies*. >
--
Ce message peut contenir des informations réservées exclusivement à son destinataire. Toute diffusion sans autorisation est interdite. Si vous n'en êtes pas le destinataire, merci de prendre contact avec l'expéditeur et de détruire ce message.
*This email may contain material for the sole use of the intended recipient. Any forwarding without express permission is prohibited. If you are not the intended recipient, please contact the sender and delete all copies*.
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery