Also, if you are using cts:search and you actually have a situation where
there is a single document you wish to exclude, you could use
cts:document-query().  I think it is generally far more desirable to find a
natural partitioning of your content as I mentioned earlier.  However, in
case you can't do that in your situation, cts:document-query() might be
appropriate.

For example:

xdmp:document-insert("a.xml", <test><my>test</my></test>)
xdmp:document-insert("b.xml", <test><my>test</my></test>)

(: returns both documents :)
let $d := cts:search(doc(),
cts:and-query((cts:element-word-query(xs:QName("my"), "test") )))
for $i in $d return fn:document-uri($i)

(: exclude "b.xml" :)
cts:search(doc(), cts:and-query((cts:element-word-query(xs:QName("my"),
"test"), cts:not-query(cts:document-query("b.xml")))) )
for $i in $d return fn:document-uri($i)

Karl

On Mon, Dec 28, 2009 at 8:45 AM, Karl Erisman <[email protected]>wrote:

> One simple way to do this would be to use collections.  If you execute the
> search against a collection or set of collections in which only your target
> documents are contained, non-target documents will be excluded.
>
> For example, a collection called "T" could include a.xml and c.xml.  b.xml
> would NOT belong to "T".  Depending on what you're trying to accomplish,
> that may be reasonable.  It's another case where *planning* the
> *organization* of your content (with respect to directories, collections,
> etc.) can make life easier or harder down the road.  I'd look for a natural
> way to partition your content using collections in a way that benefits all
> or many of your queries.
>
> Karl
>
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to