[MarkLogic Dev General] How to use cts:search to query
documents and their properties?
bindu.wavell at flatironssolutions.com
Tue Oct 28 12:42:25 PST 2008
This is what I was guessing based on the docs. I'm in the process of
modifying my ingestion code in line with this suggestion. Thanks so
much for the thorough write-up, this is exactly what I was after!
On Oct 28, 2008, at 11:20 AM, Michael Blakeley wrote:
> This might be a good time to ask whether properties are the right
> implementation for your metadata. The important feature of
> properties is
> that they are *not* part of the document. This separation has certain
> benefits, but if you want to search for two facts together, then
> properties are not the right tool for the job. Instead, both facts
> should live in the same document.
> One common approach is to include a "metadata" element within each
> document (you could name the element "inline-properties", if that
> helps). Both this metadata and the original content are under a common
> root, which could be any element you like:
> <!-- extra content goes here -->
> <!-- original content goes here -->
> Now you can search for facts within the original content, plus the
> content. At the same time, you have not made any changes to the
> content. This can also be a way to handle document-level enrichment:
> adding elements that are specially normalized for sorting, adding user
> tags, etc.
> But, you might ask, what if some of my content is binary, and I want
> use the same metadata with it? Where do the properties go? That's a
> question - and we can still use the same approach as above. But
> of setting properties on the binary document, we use an ordinary XML
> document as a proxy for the binary.
> <!-- extra content go here -->
> <binary uri="..."/>
> The binary element is a proxy for a binary document elsewhere in the
> database. It doesn't actually have to point to the binary uri, of
> course: you could choose to use a well-known convention for uri
> instead, so that you can always construct the binary uri from the
> uri, and vice-versa.
> -- Mike
> Bindu Wavell wrote:
>> I understand how to perform a cts:search against all the documents in
>> a folder. I can also perform a cts:search against property documents.
>> Is it possible to treat a document and it's properties as a single
>> element for search or combine the doc() and xdmp:document-
>> in some way in for the $expression argument to cts:search...
>> I want to find all occurrences of the word "foo" in the content and/
>> the properties for the content...
>> -- Bindu Wavell
>> Flatirons Solutions, Corp
>> General mailing list
>> General at developer.marklogic.com
> General mailing list
> General at developer.marklogic.com
More information about the General