[MarkLogic Dev General] cts:search question
Mike Sokolov
sokolov at ifactory.com
Wed Apr 18 06:24:00 PDT 2007
Mattio - The signature seems to imply you should be able to pass a
sequence of nodes using multiple paths by wrapping them in parens:
cts:search ((path1, path2, path3), ...)
you could also do multiple searches
Mattio Valentino wrote:
> Hi,
>
> I'm still coming up to speed on XQuery and MarkLogic and I can't quite
> figure out something that I'm sure will be obvious once I hear the
> answer.
>
> The signature on cts:search() is
>
> cts:search(
> $expression as node()*,
> $query as cts:query?,
> [$options as xs:string*],
> [$quality-weight as xs:double]
> ) as node()*
>
> Does "$expression as node()*" mean that I should be able to pass in
> more than one path so I can search more than one node? I initially
> assumed so, but I can't figure out how to do it after trying several
> different ways. After looking at the Shakespeare sample app I was
> able to build the query below, which works but seems a little awkward.
> Is there an easier way?
>
> let $ORIGINAL_QUERY := "test phrase"
> for $i in cts:search( //element()[self::chapter[not(descendant::entry)] |
> self::div[not(descendant::entry)] |
> self::entry |
> self::section],
> cts:word-query(
> $ORIGINAL_QUERY,
> ("case-insensitive",
> "diacritic-insensitive")
> )
> )
> return
> (: handle results sequence :)
>
> Thanks,
>
> Mattio
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
More information about the General
mailing list