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

Ashish Kumar a.kumar at mpstechnologies.com
Fri Jun 27 04:38:43 PDT 2008


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





More information about the General mailing list