Diwakar,

I think you are looking for something like this:

<constraint name="country-ISO-CC-Facet">
    <range type="xs:string" facet="true">
       <facet-option>limit=3</facet-option>
       <element ns="" name="country "/>
       <attribute ns="" name="iso-cc"/>
    </range>
</constraint>

However, if your results will contain both assigneesGeo and inventorsGeo 
elements, then this facet will count the values from both. Since 
country/@iso-cc is not specific to either, it can’t be separated out in facets. 
You could put the country elements different namespaces for each element and 
specify those in two separate facet definitions. Or if you will only want one 
type of result and you know this ahead of time, you could toggle it using 
<searchable-expression> in you search options node:

if ($condition)
then
<searchable-expression>//inventorsGeo</searchable-expression>
else
<searchable-expression>//assigneesGeo</searchable-expression>

Since you’re only faceting on the attribute, it sounds like the element range 
index won’t be needed (the parent element is already specified in the attribute 
range index). If you haven’t already, take a look at the Search Developer’s 
Guide for further reading on constraints.

http://developer.marklogic.com/learn/5.0/search-dev-guide

Best,

Will


From: [email protected] 
[mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Wednesday, February 15, 2012 10:53 PM
To: [email protected]
Subject: [MarkLogic Dev General] search:search contraint help

<assigneesGeo>
<address >
<country iso-cc="CN">People's Republic of China</lnvxe:country>
</address>
</assigneesGeo>
<inventorsGeo>
<address >
<country iso-cc="IND">People's Republic of China</lnvxe:country>
</address>
<address >
< country iso-cc="IND">People's Republic of 
China</lnvxe:country></lnvxe:address>
</address>
</inventorsGeo>

The value inside iso-cc attribute is country code
The input I will give is assigneesGeo or inventorsGeo, the output I would like 
to have is top three inventorsGeo country code count(if input is inventorsGeo)
I have element range index on country and attribute range index on iso-cc 
attribute. I am doing it in a search:search. How should my constraints be.

Thanks,
Diwakar N

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful.


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

Reply via email to