You can pass query language in as an option.  Language can be specified as an 
option for all unconstrained terms by specifying a <term-option> child to the 
<term> element, and for unconstrained terms by specifying a <term-option> child 
within the constraint.  You can use search:parse() to see how that works.

import module namespace search = "http://marklogic.com/appservices/search"; at 
"/MarkLogic/appservices/search/search.xqy";

let $options := 
 <options xmlns="http://marklogic.com/appservices/search";>
  <term apply="term">
    <empty apply="all-results"/>
    <term-option>lang=ja</term-option>
  </term>
  <constraint name="foo">
    <word>
        <element ns="" name="foo"/>
         <term-option>lang=ja</term-option>
    </word>
  </constraint>
  <constraint name="bar">
    <word>
        <element ns="" name="bar"/>
    </word>
  </constraint>
</options>

return search:parse("身 foo:身 bar:身",$options)

==>

<cts:and-query strength="20" xmlns:cts="http://marklogic.com/cts";>
  <cts:word-query qtextref="cts:text">
    <cts:text xml:lang="ja">身</cts:text>
  </cts:word-query>
  <cts:and-query strength="20">
    <cts:element-word-query qtextpre="foo:" qtextref="cts:annotation">
      <cts:element>foo</cts:element>
      <cts:annotation qtextref="following-sibling::cts:text"/>
      <cts:text xml:lang="ja">身</cts:text>
    </cts:element-word-query>
    <cts:element-word-query qtextpre="bar:" qtextref="cts:annotation">
      <cts:element>bar</cts:element>
      <cts:annotation qtextref="following-sibling::cts:text"/>
      <cts:text>身</cts:text>
    </cts:element-word-query>
  </cts:and-query>
</cts:and-query>



________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Shah, Mehul (LNG-NPV) 
[[email protected]]
Sent: Tuesday, October 05, 2010 8:26 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] language in search:search

Does search:search recognize query language? When I use search:search is there 
a way to specify query language?

i.e. if I am searching Japanese, do I need to to specify "ja" and how?

For example:
xquery version "1.0-ml";
import module namespace sr="http://marklogic.com/appservices/search";
  at "/MarkLogic/appservices/search/search.xqy";
sr:search("身")

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

Reply via email to