Hi All,

Is it possible to create the custom definition of starter for search 
grammar? I need to create both ordered/unordered type of near query 
directly from Query text. As per my understanding default query created 
through search:parse API is unordered.

Is is possible to create custom query and refer the same from search 
grammar. I am trying to create something like mentioned below but getting 
some exception. Joiner for NEAR is redefined in near-query.xqy to support 
both Ordered & Unordered based on search term.


let $search-term := "metal NEAR/50/O[Custom addition to denote Ordered] 
locker"
return
   search:parse($search-term,
        <options xmlns="http://marklogic.com/appservices/search";>
         <grammar>
            <quotation>"</quotation>
            <implicit>
              <cts:and-query strength="20" xmlns:cts="
http://marklogic.com/cts"/>
            </implicit>
            <starter strength="30" apply="grouping" delimiter=")">(</
starter>
            <starter strength="40" apply="prefix" 
element="cts:not-query">-</starter>
            <joiner strength="10" apply="infix" element="cts:or-query" 
tokenize="word">OR</joiner>
            <joiner strength="20" apply="infix" element="cts:and-query" 
tokenize="word">AND</joiner>
            <joiner strength="30" apply="joiner-near" ns="
http://xyz.com/custom/grammar"; element="cts:near-query" 
at="/near-query.xqy" tokenize="word">NEAR</joiner>
            <joiner strength="30" apply="near2" consume="2" 
element="cts:near-query">NEAR/</joiner>
            <joiner strength="50" apply="constraint">:</joiner>
            <joiner strength="50" apply="constraint" compare="LT" 
tokenize="word">LT</joiner>
            <joiner strength="50" apply="constraint" compare="LE" 
tokenize="word">LE</joiner>
            <joiner strength="50" apply="constraint" compare="GT" 
tokenize="word">GT</joiner>
            <joiner strength="50" apply="constraint" compare="GE" 
tokenize="word">GE</joiner>
            <joiner strength="50" apply="constraint" compare="NE" 
tokenize="word">NE</joiner>
          </grammar>
        </options>) 

Regards
Abhishek Srivastav
Systems Engineer
Tata Consultancy Services
Cell:- +91-9883389968
Mailto: [email protected]
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________
=====-----=====-----=====
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
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to