Hi,

I dynamically compute the options node to propose to the search api. But I 
can't handle one case.
Say I create a new Element Range Index to provide a new facets to my search. If 
I retrieve Element Range Index information from my database configuration using 
:

> import module namespace admin = "http://marklogic.com/xdmp/admin"; at 
> "/MarkLogic/admin.xqy";
>               
> let $config := admin:get-configuration()
> return admin:database-get-range-element-indexes($config, 
> xdmp:database("MyDatabase"))

The new Range Element Index is well defined and then I decide to use it for my 
search operation.

Because my database has grown up, the time this new index is actually complete 
may be important, it then results in an XDMP-ELEMRIDXNOTFOUND exception, which 
is normal because the index is not actually complete.

The question is then. How to ensure that indexes defined in the configuration 
are actually usable ?

Currently I try to fix this issue with this workaround, but :
- I don't like to rely on exception for such a feature
- This function does not handle enforce that the index exists with required 
type (dateTime, string, etc.)

> declare function local:isIndexActive($localname as xs:string, $namespace as 
> xs:string?, $collation as xs:string?) as xs:boolean {
>   try {
>     cts:element-values(fn:QName($namespace, $localname), (), ("limit=0", if 
> ($collation) then fn:concat("collaction=", $collation) else ())),
>     fn:true()
>   } catch ($e) {
>     fn:false()
>   }
> };


Do you know of something more accurate ?

Thanks
Stéphane

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to