[MarkLogic Dev General] max function alternatives

Patrick Force patrickf at arc90.com
Wed Jan 10 11:34:48 PST 2007


I'm attempting to find some alternatives in MarkLogic for improving  
the speed of a max XQuery call we currently have in place.  I believe  
the solution exists, for my case, in setting an attribute index, but  
I've been unsuccessful in my attempts so far.  The help docs for the  
administration interface don't seem to explain the meaning and exact  
use of the namespace uri values of a range index.  I believe I might  
be mixing XPath concepts into the namespace values erroneously.  A  
more detailed explanation of the scenario:

1) We have multiple documents that exist at the uri like: /c/database/ 
documents
2) Each document contains a root element like: <RootElement  
id="HPX_9876" index="9876">...etc.
3) Our current XQuery call in question: max(/RootElement/@index)
4) I've attempted to set up an attribute index via the administration  
console:
	a) scalar type: string
	b) parent namespace uri: ??? I've attempted a uri-type value like /c/ 
database/documents/RootElement but I haven't found a good explanation  
of what this value should be
	c) parent localname: RootElement
	d) namespace uri: ??? again, not sure how to set this one but have  
tried uri-type value of /c/database/documents/RootElement/@index
	e) localname: index
5) Set the above attribute index in efforts to make the following  
XQuery perform a faster max call:
	max(for $i in cts:element-attribute-values(xs:QName 
(“InsurancePolicy”),xs:QName(“id”))
		return xs:int($i))

Any ideas/suggestions would be greatly appreciated.

Patrick


More information about the General mailing list