(no subject)
Thursday, 20 September 2012 · 2 messages
JB
John Best20 Sep 2012 13:43 #
Hi there,
Below is my XML Structure –
<Docs>
<Doc>
<DocTitle C=”1”></DocTitle>
<MainDesc></MainDesc>
<FullDesc></FullDesc>
</Doc>
<Doc>
<DocTitle C=”2”></DocTitle>
<MainDesc></MainDesc>
<FullDesc></FullDesc>
</Doc> ………………….
………………….
………………….
</Docs>There are at least 6000 Doc (more to be added soon). I have created a FT Index of the same.
To search a particular word, which might be either in <MainDesc> or in <FullDesc>,
below are my queries –
Query No -1 (Time taken is 21-22 Secs)
data(doc('sample')/Docs/Doc[MainDesc[. contains text
{'unfavorable'}] or FullDesc[. contains text {'unfavorable'}]]/DocTitle/@C)Query No -2 (Time taken is 25-26 Secs)
for $x in doc('sample')/Docs/DocCG
Christian Grün20 Sep 2012 13:46 #
This might help:
data(doc('sample')/Docs/Doc[MainDesc/text() contains text
'unfavorable' or FullDesc/text() contains text
'unfavorable']/DocTitle/@C)
Quoted text · John Best · 96 lines
On Thu, Sep 20, 2012 at 1:43 PM, John Best <johnbest5673 at gmail.com> wrote: > Hi there, > > > > > > Below is my XML Structure – > > > > <Docs> > > <Doc> > > <DocTitle C=”1”></DocTitle> > > <MainDesc></MainDesc> > > <FullDesc></FullDesc> > > </Doc> > > <Doc> > > <DocTitle C=”2”></DocTitle> > > <MainDesc></MainDesc> > > <FullDesc></FullDesc> > > </Doc> > > …………………. > > …………………. > > …………………. > > </Docs> > > > > There are at least 6000 Doc (more to be added soon). I have created a FT > Index of the same. > > To search a particular word, which might be either in <MainDesc> or in > <FullDesc>, > > below are my queries – > > > > Query No -1 (Time taken is 21-22 Secs) > > data(doc('sample')/Docs/Doc[MainDesc[. contains text > {'unfavorable'}] or FullDesc[. contains text {'unfavorable'}]]/DocTitle/@C) > > > > Query No -2 (Time taken is 25-26 Secs) > > for $x in doc('sample')/Docs/Doc > > where $x[MainDesc[. contains text {'unfavorable'}] or > FullDesc[. contains text {'unfavorable'}]] > > return $x/DocTitle/@C > > > > > > The time taken is too much. How can I lower this…? > > I tried ft:search(), but it doesn’t fits in here as ft:search wont return > Nodes. > > > > > > Have a nice day > > Regards, > > JBest > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 7.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery