[MarkLogic Dev General] question about search

Micah Dubinko Micah.Dubinko at marklogic.com
Thu Aug 26 10:01:05 PDT 2010


Helen,

You are exactly on the right track. (though the default joiner is OR in uppercase, not or)

Search API doesn't (yet!) have an out-of-the-box way to combine these, and thus avoid the OR in your query.

-m

On Aug 26, 2010, at 6:49 AM, helen chen wrote:

> Hello there,
> 
> we have different kind of papers so our data are in 3 different DTDs. 
> 
> When I do search I need to do a search across all the 3 DTD data.  For example I need to search an author's name "smith" in an area that keyword="aaa", I think maybe the option node will be like the following, but I'm new to search api, and I'm wondering is there any better ways to do it, or even did I do it correct?
> 
> let $opnode := <options xmlns="http://marklogic.com/appservices/search">
>                <constraint name="s-conference-author">
>                    <value>
>                       <element ns="conf-ns" name="conference-author"/> 
>                    </value>
>                 </constraint>
>                <constraint name="s-article-author">
>                    <value>
>                       <element ns="article-ns" name="article-author"/> 
>                    </value>
>                 </constraint>
>                <constraint name="s-book-author">
>                    <value>
>                       <element ns="book-ns" name="book-author"/> 
>                    </value>
>                 </constraint>
>                <constraint name="s-conference-keyword">
>                    <value>
>                       <element ns="conf-ns" name="conference-keyword"/> 
>                    </value>
>                 </constraint>
>                <constraint name="s-article-keyword">
>                    <value>
>                       <element ns="article-ns" name="article-keyword"/> 
>                    </value>
>                 </constraint>
>                <constraint name="s-book-keyword">
>                    <value>
>                       <element ns="book-ns" name="book-keyword"/> 
>                    </value>
>                 </constraint>
>                    </options>
> return
> search:search("  (s-conference-author:smith or s-article-author:smith or  s-book-author:smith)  and (s-conference-keyword or s-article-keyword or s-book-keyword) ", $opnode)  
> 
> 
> Thanks, Helen
> 
> 
> 
> 
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general



More information about the General mailing list