Isha

I don't know If I property understood your question. If it is something 
like creating constraint with multiple attributes, then default constraint 
definition with more than one pair of element attribute is not possible. 
You need to create the custom constraint and the parse function of the 
custom query will be similar to

cts:element-attribute-range-query(
                xs:QName("taxonomy-level") 
                (xs:QName("id"),xs:QName("generation")  ),
                "=",
                $right-value
)

Hope this can serve your purpose a bit.

Thanks
Abhishek Srivastav
Tata Consultancy Services
Cell:- +91-9883389968
Mailto: abhishek5...@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



From:
isha chadha <ishacha...@hotmail.co.uk>
To:
<general@developer.marklogic.com>
Date:
08/22/2011 06:23 PM
Subject:
Re: [MarkLogic Dev General] Query on ML search
Sent by:
general-boun...@developer.marklogic.com



So basically, I am trying to figure out if there is a way to do something 
like:

Constraint added while performing a search
<constraint name="taxonomy-level">
                <range type="xs:int" >
                    <element ns="
http://www.dods.co.uk/alfresco/content-meta/1.0"; name="taxonomy-level"/>
                    <attribute ns="" name="id"/> 
                    <attribute ns="" name="generation"/> 
                </range>
</constraint>

or 

<constraint name="hierarchicalTaxonomy">
                 <value>
                    <element ns="
http://www.dods.co.uk/alfresco/content-meta/1.0"; 
name="hierarchical-taxonomy"/>
                 </value>
            </constraint>

From: ishacha...@hotmail.co.uk
To: general@developer.marklogic.com
Date: Mon, 22 Aug 2011 13:46:51 +0100
Subject: Re: [MarkLogic Dev General] Query on ML search

Thanks Abhishek.
This is what I am doing (Performing a reverse search)

ket  $search-options:= <options xmlns="
http://marklogic.com/appservices/search";>
            <return-results>true</return-results>
            <return-facets>true</return-facets>
            <return-qtext>true</return-qtext>
            <constraint name="type">
                <range type="xs:string" collation="
http://marklogic.com/collation/";>
                    <element ns="
http://www.dods.co.uk/alfresco/content-properties/1.0"; name="type" />
                </range>
            </constraint>
            <constraint name="source">
                <range type="xs:string" collation="
http://marklogic.com/collation/";>
                    <element ns="
http://www.dods.co.uk/alfresco/content-meta/1.0"; name="source"/>
                </range>
            </constraint>
            <constraint name="keyword">
                <range type="xs:string" collation="
http://marklogic.com/collation/";>
                    <element ns="http://dods.co.uk/ns/dod"; 
name="keyword"/>
                    {$facet-option-node} 
                </range>
            </constraint>
            <constraint name="taxonomy-level">
                <range type="xs:int" >
                    <element ns="
http://www.dods.co.uk/alfresco/content-meta/1.0"; name="taxonomy-level"/>
                    <attribute ns="" name="id"/> 
                </range>
            </constraint>
            <constraint name="id">
                <value type="xs:string" collation="
http://marklogic.com/collation/";>
                    <element ns="
http://www.dods.co.uk/alfresco/content-properties/1.0"; name="id"/>
                </value>
            </constraint>
            <transform-results 
                apply="search-snippet" 
                ns="http://dods.co.uk/modules/search/snippet-renderer";
                at="/application/libraries/snippet-renderer.xqy"> 
                <preferred-elements>
                    <element ns="http://docbook.org/ns/docbook"; 
name="title"/>
                </preferred-elements>
                <max-matches>100</max-matches>
                <max-snippet-chars>400</max-snippet-chars>
            </transform-results>
            <max-snippet-chars>400</max-snippet-chars>
            <max-matches>1</max-matches>
            <term>
                <term-option>case-insensitive</term-option>
            </term>
        <searchable-expression >fn:doc("C") 
            </searchable-expression>
        </options>;

let $reverse-search-options := <options xmlns="
http://marklogic.com/appservices/search";>
{$search-options/*}
<searchable-expression >fn:doc("C") 
        </searchable-expression>
</options>
(: get all search strings converted back from CTS :)
let $searchDocs := for $doc in A,B
(: either it matches or it does not :)
return if (search:search(
search:unparse($doc/child::node()),
 $reverse-search-options, 0, 1 )[@total gt 0]) then 
 (fn:doc(fn:base-uri($doc))) else ()
return FINAL RESULT

To: general@developer.marklogic.com
From: abhishek5...@tcs.com
Date: Mon, 22 Aug 2011 18:08:38 +0530
Subject: Re: [MarkLogic Dev General] Query on ML search


Isha 

Can you please put the options and query you are using for saerch? 

Thanks 
Abhishek Srivastav
Tata Consultancy Services
Cell:- +91-9883389968
Mailto: abhishek5...@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.        IT Services
                       Business Solutions
                       Outsourcing
____________________________________________ 


From: 
isha chadha <ishacha...@hotmail.co.uk> 
To: 
<general@developer.marklogic.com> 
Date: 
08/22/2011 06:01 PM 
Subject: 
[MarkLogic Dev General] Query on ML search 
Sent by: 
general-boun...@developer.marklogic.com




Hi All, 
  
I have a following use case: 
  
Two documents saved in ML against which to perform the search: 
  
A 
  
<dods:taxonomy> 
<dods-meta:hierarchical-taxonomies> 
<dods-meta:hierarchical-taxonomy> 
<dods-meta:taxonomy-level generation="1" id="24907">Climate 
change</dods-meta:taxonomy-level> 
</dods-meta:hierarchical-taxonomy> 
</dods-meta:hierarchical-taxonomies> 
</dods:taxonomy> 
  
B 
<dods:taxonomy> 
<dods-meta:hierarchical-taxonomies> 
<dods-meta:hierarchical-taxonomy> 
<dods-meta:taxonomy-level generation="1" id="24907">Climate 
change</dods-meta:taxonomy-level> 
<dods-meta:taxonomy-level generation="2" 
id="24908">Financing</dods-meta:taxonomy-level> 
</dods-meta:hierarchical-taxonomy> 
</dods-meta:hierarchical-taxonomies> 
</dods:taxonomy> 
  
  
Newly inserted document to be searched 
  
C 
  
<dods:taxonomy> 
<dods-meta:hierarchical-taxonomies> 
<dods-meta:hierarchical-taxonomy> 
<dods-meta:taxonomy-level generation="1" id="24907">Climate 
change</dods-meta:taxonomy-level> 
<dods-meta:taxonomy-level generation="2" 
id="24908">Financing</dods-meta:taxonomy-level> 
</dods-meta:hierarchical-taxonomy> 
</dods-meta:hierarchical-taxonomies> 
</dods:taxonomy> 
  
  
Constraint I am using while performing a search 
<constraint name="taxonomy-level"> 
                <range type="xs:int" > 
                    <element ns="
http://www.dods.co.uk/alfresco/content-meta/1.0"; name="taxonomy-level"/> 
                    <attribute ns="" name="id"/> 
                </range> 
</constraint> 
  
This results in both A and B getting selected. How can I make sure that 
only B gets selected as it is the exact match for C? 
  
Thanks, 
Isha 
 _______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



_______________________________________________ General mailing list 
General@developer.marklogic.com 
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________ General mailing list 
General@developer.marklogic.com 
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to