Thanks Erik.
An <additional-query> element is allowed inside the <state> element, but
I think that translates to an and-query. Is there a way to get an
or-query in there? In pseudo-code:
<operator name="sort">
<state name="relevance">
<sort-order><score/></sort-order>
<or-query>{myfn:something_in_query_string_is_inside_my:title}</or-query>
</state>
</operator>
(I can do a quick and dirty tokenize of the query string to avoid
parsing it first.)
What I'd like is a way in search:search options to make docs with query
terms inside the <my:title> element rank higher than docs with query
terms elsewhere.
Best,
Tim Finney
On 05/31/2013 08:03 PM, Erik Hennum wrote:
> 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
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general