Hi, Shashidhar:

If the two elements don't occur in the same document, you could create a field 
in the Admin UI and define a constraint for the field.

Otherwise, you could write and install a custom constraint with a parse 
function (and not the start or finish facet functions unless you need facets) 
that returns an AND query over the two elements.

    http://docs.marklogic.com/guide/search-dev/search-api#id_49750


Hoping that's useful,


Erik Hennum

________________________________
From: [email protected] 
[[email protected]] on behalf of Shashidhar Rao 
[[email protected]]
Sent: Tuesday, April 21, 2015 7:38 AM
To: [email protected]
Subject: [MarkLogic Dev General] Same contraints name with multiple element 
indexes

Hi,

Is it possible to have the same contraints name with multiple range index 
elements.

The following I tried but only worked for one qname not multiple is there a way 
could somebody help me as I need to search from different element range indexes 
with the same contraint.

Here's my code
    String optionsName = "product";
        QueryOptionsManager optMgr = 
client.newServerConfigManager().newQueryOptionsManager();

        // create the builder for query options
        QueryOptionsBuilder optBldr = new QueryOptionsBuilder();

        // create a handle on the built query options
        QueryOptionsHandle optHandle = new QueryOptionsHandle();

        // support constraints on the artistName and writer element indexes
        optHandle.withConstraints(
            optBldr.constraint("product",
                optBldr.elementQuery(new QName("description"))
            ),
            optBldr.constraint("product",
                    optBldr.elementQuery(new QName("summary"))
                )
        );

Thanks
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to