Hi, I am trying to work out facet based search. Basically I have added <facet-def in search criteria and facets in lib-search-custom.xqy.
I do get search:search-summary along with parse/search/estimate/summary/facet time and document-uri in the results But I dont see any results for facets based search. Basically I have 5 articles in the database and all have PublisherName tag. So I suppose it should give results for "PublisherName" with the total no articles as 5. What I am missing here. Pointers to the following will be appreciated. Here goes the code. 1. Search Criteria in cq import module namespace search="http://www.marklogic.com/ps/lib/lib-search" at "lib-search.xqy" import module "http://www.marklogic.com/ps/lib/lib-search" at "lib-search-custom.xqy" search:search-summary( <search:search-criteria> <search:term><search:text>cell</search:text></search:term> <facet-def do-count="true"> <facet-def-id>PublisherName-facet-id</facet-def-id> </facet-def> </search:search-criteria> , 1, 5) 2. Config element in lib-search-custorm.xqy 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> <namespaces> <namespace prefix="sp">http://www.foo.com</namespace> </namespaces> <base-criteria> <search:directories depth="infinity"> <search:directory>lib-searchWebDev/</search:directory> </search:directories> </base-criteria> <sort-fields> <sort-field id="ChapterTitle" type="xs:string" direction="ascending"> Publisher//Chapter/ChapterInfo/ChapterTitle </sort-field> <sort-field id="CopyrightYear" type="xs:integer" direction="ascending"> Publisher//Chapter//ChapterCopyright/CopyrightYear </sort-field> </sort-fields> <max-summarize-matches>5</max-summarize-matches> <truncate-word-count>7</truncate-word-count> </search> <facets> <default-do-count>true</default-do-count> <search:value-facet id="PublisherName-facet-id"> <search:element id="PublisherName"> <search:namespace></search:namespace> <search:local-name>PublisherName</search:local-name> </search:element> </search:value-facet> </facets> </config> } _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
