[MarkLogic Dev General] search:search() - show phrase results first

Will Thompson wthompson at jonesmcclure.com
Tue Mar 13 08:46:06 PDT 2012


As far as I know, there isn't an out of the box option that allows you to do this, but most of the cts:query functions take weight as a parameter. You could use search:parse() to generate cts:query XML, and then rebuild the query using your own logic to assign new weights, and pass that output to search:resolve().

However, if you are just trying to return the most relevant documents first, I would leave the query alone and rely on MarkLogic's TF-IDF ranking, as Mike has recommended.


From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Danny Sinang
Sent: Monday, March 12, 2012 5:21 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] search:search() - show phrase results first

Hi Will,

Thanks. How can I adjust the query weights for the phrase search ? Is there a ready made function / option for this ?


On Mar 12, 2012, at 6:35 PM, Will Thompson <wthompson at jonesmcclure.com<mailto:wthompson at jonesmcclure.com>> wrote:

To be certain, you would need to do two searches and display the results one after the other - depending on how your paging is set up, you could see how many results remain in the phrase search before you execute the second search.

Alternately, you might be able to get similar results by OR-ing the two queries together and adjusting the query weights such that a phrase will always outscore any other word combinations.


From: general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com> [mailto:general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com>] On Behalf Of Danny Sinang
Sent: Monday, March 12, 2012 2:26 PM
To: general
Subject: [MarkLogic Dev General] search:search() - show phrase results first


Am looking to implement a business rule that says "Phrase results must be displayed before partials".

So if, using search:search(), I looked for the phrase "medical research", all results having that exact phrase should be shown first, followed by results for "medical" and "research".

A previous contractor managed to implement the generation of the phrase results + partials.  But the problem is, some of the results for "medical" and "research" are displayed first because of their higher scores.

How do I tell MarkLogic to give phrase results a higher score instead ?


General mailing list
General at developer.marklogic.com<mailto:General at developer.marklogic.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120313/b4a8a2dc/attachment-0001.html 

More information about the General mailing list