Hi Geert,

Thank you.  Unfortunately, that would require to create fields for any
possible combination of elements.  The list of elements is computed
algorithmically, and that would not be possible with fields.

Furthermore, I think that would not allow to give different weights to
different elements either, would it?  Basically, I need to be able to say
"element foo weight 10, element bar weight 5, etc."

So I guess my question is, is not there any way to ask search:search() to
generate cts:and-query((cts:element-word-query(),
cts:element-word-query())) instead of a simple cts:element-word-query(),
for a simple term search string?

Regards,

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


On 23 October 2017 at 17:44, Geert Joste wrote:

> I think I would use a field for this..
>
> Cheers,
> Geert
>
> From: <[email protected]> on behalf of Florent
> Georges <[email protected]>
> Reply-To: MarkLogic Developer Discussion <[email protected]>
> Date: Monday, October 23, 2017 at 4:42 PM
> To: MarkLogic Developer Discussion <[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
> http://fgeorges.org/
> http://h2o.consulting/ - New website!
>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to