Are xml attributes indexed by default Hi Jon,
You always have the Word index (Word lexicon), which can be explicitly used with cts:element-attribute-word-query (and the element counterpart cts:element-word-query. You will have to enable wildcard switches on the database to use wildcards within the searched values. If you want to lookup exact values, you might be better off with a range index, which can be explicitly used with cts:element-value-query and cts:element-attribute-value-query. Whether or not XPath expressions are backed by these indexes and lexicons, depends how well the query optimizer is able to match them. You might be interested in this blog item from Evan, which explains how you can analyze this: http://developer.marklogic.com/blog/learning-with-query-trace However, I think you are asking something different here, looking at your code. To be honest, the argument of xinc:node-expand looks rather suspicious. /* accesses the entire database, but you do it a second time in the predicate. That is indeed very expensive. Can you put in words what you are trying to do? We might be able to suggest better ways of handling this.. Kind regards, Geert *Van:* general-boun...@developer.marklogic.com [mailto: general-boun...@developer.marklogic.com] *Namens *Jonathan Cook - FM&T *Verzonden:* woensdag 11 januari 2012 12:56 *Aan:* general@developer.marklogic.com *Onderwerp:* [MarkLogic Dev General] Are xml attributes indexed by default Hi, Are attributes indexed by default in Mark Logic Server? The documentation says the whole document structure is indexed but that doesn’t answer the question really. For example I want to ensure the href attribute is indexed for the following xquery: *xquery* version "1.0-ml"; import module *namespace* *xinc* = "http://marklogic.com/xinclude" at "/MarkLogic/*xinclude*/xinclude.xqy"; let $public_url := "%s" let $results := xinc:node-expand(/*[ /*/itemMeta/url[*@href*=$public_url] ]) let $asset := $results[1] return $asset Perhaps the above xquery isn’t very efficient as I also read widcards couldn’t be used with indexes? This option is set to false but I suspect this is something different: “Index attribute value positions for faster near searches involving element-attribute-value-query (slower document loads and larger database files).” Thanks Jon
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general