Hi, Tim:

If I understand your goals correctly:

*  Your options should create a word constraint on the my:title element that 
contains a weight element with a number larger than the default (1.0)
*  If you are using a structured query, your query should use an or query that 
makes the word constraint optional.  If you are using a string query, the word 
constraint will be included only if the user supplies the string.

You might need to experiment to get the weighting factor right.

The documentation for weight:

    http://docs.marklogic.com/guide/search-dev/relevance#id_22791


Hoping that helps,


Erik Hennum

________________________________________
From: [email protected] 
[[email protected]] on behalf of Tim Finney 
[[email protected]]
Sent: Friday, May 31, 2013 4:33 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Additional query when sorting by score

Hi All,

I want to change the behavior of a sort operator using the options node
for search:search. I have this at the moment:

<operator name="sort">
   <state name="relevance">
     <sort-order><score/></sort-order>
   </state>
</operator>

I'd like to change things so that a doc which includes search terms in
its <my:title> element is returned higher in the results. Can I do this
using an additional query in the options node or in some other way? I'd
like to be able to do things in one pass (i.e. not have to parse the
query separately).

Best,

Tim Finney
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to