[MarkLogic Dev General] lp:mapping syntax for element-attribute searching

Alan Darnell alan.darnell at utoronto.ca
Fri Jul 11 10:31:03 PDT 2008


I can't find examples in the documentation of how to set up mappings  
for lib-parser for element-attribute searching.

Here's what I have now in lib-search-custom.xqy

     <config
             xmlns="http://www.marklogic.com/ps/lib/lib-search/config"
             xmlns:lp="http://www.marklogic.com/ps/lib/lib-parser"
             xmlns:sp=""
             xmlns:sp-custom="http://scholarsportal.info/metadata">

         <search allow-empty-terms="false" fast-pagination="false">

                 <lp:search-field-map>
                         <lp:mapping code="TI"><sp:article-title /></ 
lp:mapping>
                         <lp:mapping code="KW"><sp:kwd /></lp:mapping>
                         <lp:mapping code="AB"><sp:abstract /></ 
lp:mapping>
                         <lp:mapping code="SO"><sp:journal-title /></ 
lp:mapping>
                         <lp:mapping code="PD"><sp-custom:publication- 
date /></lp:mapping>
                 </lp:search-field-map>
...

and it works great for element searches.

I want to search an attribute now however where I keep track of the  
load date for the document, so I tried this:

<lp:mapping code="LD"><sp-custom:loading-info/@date /></lp:mapping>

but lib-search generated an error.  Is it possible to map an attribute?

Really enjoying working with this lib-search library -- once you get  
the hang of it it is so easy to add new search features and see if  
your data model supports what you want to do on the front end.

Alan


More information about the General mailing list