[MarkLogic Dev General] question about fields

Alan Darnell alan.darnell at utoronto.ca
Mon Aug 6 08:58:52 PDT 2007


My data splits author names into two separate elements -- surname and  
given-names.  I want to be able to search the combined elements as if  
they were one element so I can pass in something like "bill smith" or  
"smith bill" to s single cts:word-query and get something back.

So I set up a "field" using the new functionality in 3.2 and included  
both elements.  But when I try to search with a query like this:

cts:field-word-query("full_author", "smith bill")

I get zero results.  It seems that the only way to get results from  
the field is with two separate word queries:

e.g.

let $q1 := cts:field-word-query("full_author","smith")
let $q2 := cts:field-word-query("full_author","bill")
return
cts:search(doc()//contrib,cts:and-query(($q1,$q2))) [1 to 5]

Am I doing something wrong in the field setup or is this the way  
fields work?  If so, it doesn't seem  much different that having to  
use two anded element-word queries.

Thanks in advance.

Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20070806/6f119349/attachment.html


More information about the General mailing list