Hi,

Can someone help me on creating the query options , the first one using

1. QueryOptionsBuilder in Java API works but with xml it is not working,
the result I am getting is

1. US 100
2. JP   49
3. ES   23

Basically , I am getting the country and the counts .

QueryOptionsBuilder qob = new QueryOptionsBuilder();

        // expose the "SPEAKER" element range index as "speaker" values
        QueryOptionsHandle options = new QueryOptionsHandle().withValues(
            qob.values("country",
                    qob.range(
                        qob.elementRangeIndex(new QName("country"),

qob.stringRangeType(QueryOptions.DEFAULT_COLLATION))),
                    "frequency-order"));


2. QueryOptionsManager optionsMgr =
client.newServerConfigManager().newQueryOptionsManager();

        // construct the query options
        String optionXml =
                "<search:options "+
                        "xmlns:search='
http://marklogic.com/appservices/search'>"+
                    "<search:constraint name='country'>"+
                        "<search:range collation='
http://marklogic.com/collation/' type='xs:string' facet='true'>"+

"<search:facet-option>frequency-order</search:facet-option>"+

"<search:facet-option>descending</search:facet-option>"+

"<search:facet-option>limit=10</search:facet-option>"+
                            "<search:element ns='' name='country'/>"+
                        "</search:range>"+
                    " </search:constraint>"+
                "</search:options>";

        // create a handle to send the query options
        StringHandle writeHandle = new StringHandle(optionXml);

        // write the query options to the database
        optionsMgr.writeOptions(OPTIONS_NAME, writeHandle);
        QueryManager queryMgr = client.newQueryManager();
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to