I think I would use a field for this..

Cheers,
Geert

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Florent Georges <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Monday, October 23, 2017 at 4:42 PM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Set of elements to search for search:search()

Hi,

I am using the Search API, AKA search:search().  I need to restrict the set of 
elements to use for a search string with no specific constraint (e.g. "this AND 
that" as opposed to "this:that").

As a simplification, let's say I need to restrict the search to two elements, 
namely "foo" and "bar", in no namespace, with different weights.  I would have 
used the following, but "default" seems to accept only one "word":

search:search(
   'this AND that',
   <options xmlns="http://marklogic.com/appservices/search";>
      <term>
         <default>
            <word>
               <element name="foo" ns=""/>
               <weight>10.0</weight>
            </word>
            <word>
               <element name="bar" ns=""/>
               <weight>5.0</weight>
            </word>
         </default>
      </term>
   </options>)

MarkLogic does not complain on this one, but only takes the first one into 
account (well, at least the results returned are as if it was).

I feel I am missing something obvious here.  How is it possible to restrict a 
full text search to a set of element names using search:search()?

Regards;

--
Florent Georges
H2O Consulting
http://h2o.consulting/


_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to