[MarkLogic Dev General] Unable to sort results through lib-search

Frank Sanders Frank.Sanders at marklogic.com
Fri Jun 27 07:54:34 PDT 2008


Not sure of what results you're getting, but from the code you've posted it
looks like you need to change your search-directory element from:

<search:directory>testWebDAVServer/</search:directory>

To

<search:directory>/testWebDAVServer/</search:directory>

-fs

-----Original Message-----
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Ashish Kumar
Sent: Friday, June 27, 2008 7:39 AM
To: general at developer.marklogic.com
Subject: [MarkLogic Dev General] Unable to sort results through lib-search

Hi,
Pointers to the following problem will be highly appreciated.
I am unable to sort search results using lib search.
Also I see the api is broken for highlighting the results in lib-search. Any
idea when it would be available.

Here is the code which I am trying to sort the results. What I am missing
here?

1. In lib-search-custorm.xqy I have set the $CONFIG AS 
define variable $CONFIG as element(cfg:config) {
    (: Configuration file -- Put whatever you want here, or nothing at all.
:)
    <config xmlns="http://www.marklogic.com/ps/lib/lib-search/config">
	<search>

		<base-criteria>
			<search:directories depth="1">
	
<search:directory>testWebDAVServer/</search:directory>
			</search:directories>
		</base-criteria>
		<sort-fields>
			<sort-field id="pName" type="xs:string"
				direction="ascending"
	
>/Publisher/PublisherInfo/PublisherName</sort-field>
		</sort-fields>
		<max-summarize-matches>5</max-summarize-matches>
		<truncate-word-count>7</truncate-word-count>
	</search>

    </config>
}

/Publisher/PublisherInfo/PublisherName is the path from root.

2. Now when I fire my query for sort it does not work

import module namespace search="http://www.marklogic.com/ps/lib/lib-search"
at "lib-search.xqy"
import module namespace search1="http://www.marklogic.com/ps/lib/lib-search"
at "lib-search-custom.xqy"


search:search-results(
<search:search-criteria>
<search:term><search:text>humana</search:text></search:term>
<search:element><search:local-name>Body
</search:local-name></search:element>
<sort><sort-field type="xs:string"> pName
</sort-field><sort-field-id>ChapterTitle</sort-field-id></sort>
</search:search-criteria>
, 1, 5) 

Thanx in Advance,
/Ashish



_______________________________________________
General mailing list
General at developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4245 bytes
Desc: not available
Url : http://xqzone.marklogic.com/pipermail/general/attachments/20080627/a36d9b52/smime.bin


More information about the General mailing list