[MarkLogic Dev General] Language Support

Danny Sokolsky dsokolsky at marklogic.com
Wed Oct 8 14:51:25 PDT 2008


Hi Shannon,

You can do a cts:or-query with different language queries.  For example,
the following returns true for both cts:contains expressions:

let $x :=
<doc>
	<div>
		<p>unanimous suffrages</p>
	</div>
	<div>
		<p xml:lang="fr">et qui atteste Les Suffrages
unanimes</p>
	</div>
</doc>

return
(
cts:contains($x/div[1], cts:or-query((
      cts:word-query("suffrages", "lang=en"),
      cts:word-query("suffrages", "lang=fr") )) ),
cts:contains($x/div[2], cts:or-query((
      cts:word-query("suffrages", "lang=en"),
      cts:word-query("suffrages", "lang=fr") )) )
)
(: returns true true :)

-Danny
-----Original Message-----
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Shannon
Sent: Wednesday, October 08, 2008 2:26 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Language Support

Hello,

Reading Language Support in Developer's Guide, it's not entirely clear  
how to perform a multi-language-aware full-text query--do I simply use  
multiple cts:query constructors with appropriate lang options in a  
cts:or-query?

Given a database default language of English, a div element fragment  
root, and the following content loaded:

<doc>
	<div>
		<p>unanimous suffrages</p>
	</div>
	<div>
		<p xml:lang="fr">et qui atteste Les Suffrages
unanimes</p>
	</div>
</doc>

Taking advantage of the French language module, I want my cts:search  
to recall both divs when the cts:word-query is on "suffrage" --  
tokenized and stemmed for both languages.  Passing the list  
("lang=en", "lang=fr") as the options expression doesn't do the trick,  
although that would be easier to code....

Thanks,
__________________________________________________
Shannon Scott Shiflett, programmer/analyst with ROTUNDA,
The University of Virginia Press, Charlottesville, VA  USA
http://rotunda.upress.virginia.edu

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


More information about the General mailing list