[XQZone General] Re: String searching

Jason Hunter jhunter at marklogic.com
Mon Oct 18 09:57:45 PDT 2004


You can generalize quite that far.  The rule of thumb to follow is that 
you're going to have better performance the more "directly" or 
"normally" you can write your query.  The goal when writing queries is 
to make use of the engine's indexes.  The query I wrote below is easier 
for the optimizer to translate to indexed lookups than your query which 
had unnecessary nesting.

-jh-

Steven Condas wrote:

> Thanks Jason.  It seems as though any time I have a nested predicate I 
> have a performance problem.  Is this a generic characteristic of CIS?
>  
> Steve
> 
> */Jason Hunter <jhunter at marklogic.com>/* wrote:
> 
>     To do that you write this:
> 
>     input()//pin[cts:contains(element1, "Blue")]
> 
>     -jh-
> 
>     Steven Condas wrote:
> 
>      > Jason,
>      >
>      > Thanks, that seems to work great. Now that I have that working I
>     tried
>      > the following:
>      >
>      > input()//pin[element1[cts:contains(., "Blue")]]
>      >
>      > in order to get the that has that characteristic. This
>      > query times out.
>      >
>      > Steve
>      >
>      > */Jason Hunter /* wrote:
>      >
>      > (Forwarding to general@ which is the real mailing list. The original
>      > went to general-owner.)
>      >
>      > To answer your question, try this:
>      >
>      > input()//pin/element1[cts:contains(., "Blue")]
>      >
>      > cts:contains() searches for the token "Blue" rather than a raw
>      > character-by-character search so the above should execute very
>     quickly
>      > regardless of data set size.
>      >
>      > -jh-
>      >
>      > Steven Condas wrote:
>      >
>      > > I am new to CIS and I am running into a little difficulty. I have a
>      > > database with 50000 documents on it. I am trying to do the
>      > > following query:
>      > >
>      > > xdmp:query-trace(true()) ;
>      > >
>      > > {
>      > > input()//pin/element1[contains(./text(), "Blue")]
>      > > }
>      > >
>      > > This query is based upon the "String Search" use case.
>      > Unfortunately,
>      > > the query times out before returning any results and I don't
>     see any
>      > > tracing in the error log.
>      > >
>      > > Steve
>      > >
>      > >
>      >
> 



More information about the General mailing list