Thanks Danny,
I did try your first option, but I'm going to give number 2 a shot and see what happens! Thanks Nicole ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Danny Sokolsky Sent: Friday, October 05, 2007 10:44 PM To: General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Limiting cts-search to fields Hi Nicole, I can think of two ways you might accomplish this. 1) You can make the first parameter of your cts:search only cover the things you want to search with an or. Something like: //METS:dmdSec/METS:mdWrap/METS:xmlData/(dc:title | dc:creator | dc:date | dc:type | etc | etc) making sure to leave the element you want to exclude off the list. The problem here is that it would return the inside elements that match the search, and you wanted the METS:dmdSec element. You can achieve that by sticking an XPath on the end of your search, something like this: declare namespace METS="foo" declare namespace dc="bar" let $query := cts:word-query("Article") return cts:search(doc("test.xml")//METS:dmdSec/METS:mdWrap/METS:xmlData/(dc:tit le | dc:creator | dc:date | dc:type), $query)/ancestor::METS:dmdSec It seems like you might get some duplicates with this method, too (for example, if you had a match in both a title and creator elements having the same METS:dmdSec ancestor), and you would have to deal with that. 2) Alternately, you can use the 3.2 Fields feature and create a field that excludes the dc:source element. Then your cts:query would use cts:field-word-query instead of what your mlps:get-cts-query generates (presumably you would need to modify that function to generate the cts:field-word-query constructor). There may be other ways, but I can't think of them right now. -Danny -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Engard, Nicole Sent: Tuesday, October 02, 2007 9:42 AM To: [email protected] Subject: [MarkLogic Dev General] Limiting cts-search to fields I'm looking to limit what fields our search looks at when pulling results. We have this function: define function quick-search ($params as node()) as node()* { let $query := mlps:get-cts-query(fn:data($params/terms)) let $raw-results := cts:search(//METS:dmdSec,$query) let $results := build-results($params, $raw-results, $query) return ( if ($results/result) then (v:display-results($params, $results)) else v:display-no-results($params) ) } And here is a snippet of the XML <METS:dmdSec ID="dmd002"> <METS:mdWrap MIMETYPE="text/xml" MDTYPE="DC" LABEL="Dublin Core Metadata"> <METS:xmlData> <dc:title>Front Cover</dc:title> <dc:creator/> <dc:date>1984</dc:date> <dc:type>Article</dc:type> <dc:language>English</dc:language> <dc:source>Bibliographie Karl Barth Band 1: Veröffentlichungen von Karl Barth (1984)</dc:source> <dc:coverage>fa-fb</dc:coverage> <dc:description/> <dc:subject/> </METS:xmlData> </METS:mdWrap> </METS:dmdSec> What I want is to have the search search everything but the source field. I'm up for any suggestions! Thanks, Nicole C. Engard Metadata Librarian Princeton Theological Seminary Libraries Email: [EMAIL PROTECTED] Phone: 609.430.2773 Web: http://libweb.ptsem.edu
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
