Thanx Frank it is working fine. Here are the steps 1. Define range index for the element ST through admin interface (Refer chapter 16 Text indexing in admin guide) 2. In lib-search-custom.xqy Define facets
<facets> <default-do-count>true</default-do-count> <search:value-facet id="ST-facet-id"> <search:element id="ST"> <search:namespace></search:namespace> <search:local-name>ST</search:local-name> </search:element> </search:value-facet> </facets> 3. in your search criteria search:search-results( <search:search-criteria> <search:term><search:text>cell</search:text></search:term> <search:facet-defs> <search:facet-def do-count="true"> <search:facet-def-id>ST-facet-id</search:facet-def-id> </search:facet-def> </search:facet-defs> </search:search-criteria> , 1, 5) I hope this will help other people googling. Thanx again Frank. Rgards, Ashish -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 12:30 AM To: [email protected] Subject: General Digest, Vol 49, Issue 19 Send General mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit http://xqzone.com/mailman/listinfo/general or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of General digest..." Today's Topics: 1. RE: Lib search facets based search (Ashish Kumar) 2. Re: RE: Lib search facets based search (Frank Rubino) 3. Re: RE: Lib search facets based search (Frank Rubino) 4. Facebook XQuery Library (David Amusin) ---------------------------------------------------------------------- Message: 1 Date: Tue, 15 Jul 2008 09:56:18 +0530 From: "Ashish Kumar" <[EMAIL PROTECTED]> Subject: [MarkLogic Dev General] RE: Lib search facets based search To: <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="us-ascii" Thanx for the reply, One thing I was missing here, I didn't define range indexes. Even after defining range indexes through Admin interface, facet search is not working for me. I still don't see any information in the results. Any more clue. I have tried prefixing search: also as suggested by Christopher. Regards, /Ashish ------------------------------ Message: 4 Date: Fri, 11 Jul 2008 12:20:51 -0400 From: Alan Darnell <[EMAIL PROTECTED]> Subject: Re: [MarkLogic Dev General] Lib search facets based search To: General Mark Logic Developer Discussion <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Ashish, Here's the facet definition section in the lib-search-custom file that we use and that works for us. Of course, we have range indexes defined for each of the element or attributes we want to facet on. Alan <facets> <default-do-count>true</default-do-count> <search:value-facet id="kwd-facet"> <search:element> <search:local-name>kwd</search:local-name> </search:element> <search:top>10</search:top> </search:value-facet> <search:value-facet id="journal-facet"> <search:element> <search:local-name>journal-title</search:local-name> </search:element> <search:top>10</search:top> </search:value-facet> <search:value-facet id="article-type-facet"> <search:element-attr> <search:local-name>article</search:local-name> <search:attr-local-name>article-type</search:attr- local-name> </search:element-attr> <search:top>10</search:top> </search:value-facet> </facets> ------------------------------ Message: 5 Date: Fri, 11 Jul 2008 09:40:14 -0700 From: "Christopher Welch" <[EMAIL PROTECTED]> Subject: RE: [MarkLogic Dev General] Lib search facets based search To: "General Mark Logic Developer Discussion" <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="us-ascii" On quick inspection it looks as if you didn't specify your namespaces on the facet-def elements. Try prefixing all the facet-def elements with search:. -----Original Message----- From: Ashish Kumar [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2008 2:53 PM To: '[email protected]' Subject: Lib search facets based search 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> } ------------------------------ Message: 2 Date: Tue, 15 Jul 2008 07:46:53 -0400 From: Frank Rubino <[EMAIL PROTECTED]> Subject: Re: [MarkLogic Dev General] RE: Lib search facets based search To: General Mark Logic Developer Discussion <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="US-ASCII" Marc- Do we have an agenda for kickoff Friday? I'm taking a 1 PM flight, which means leaving the hotel at 11:30AM. Frank On 7/15/08 12:26 AM, "Ashish Kumar" <[EMAIL PROTECTED]> wrote: > > Thanx for the reply, One thing I was missing here, I didn't define range > indexes. Even after defining range indexes through Admin interface, facet > search is not working for me. I still don't see any information in the > results. > > Any more clue. > I have tried prefixing search: also as suggested by Christopher. > > Regards, > /Ashish > ------------------------------ > > Message: 4 > Date: Fri, 11 Jul 2008 12:20:51 -0400 > From: Alan Darnell <[EMAIL PROTECTED]> > Subject: Re: [MarkLogic Dev General] Lib search facets based search > To: General Mark Logic Developer Discussion > <[email protected]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > Ashish, > > Here's the facet definition section in the lib-search-custom file that we > use and that works for us. Of course, we have range indexes defined for > each of the element or attributes we want to facet on. > > Alan > > <facets> > <default-do-count>true</default-do-count> > > <search:value-facet id="kwd-facet"> > <search:element> > <search:local-name>kwd</search:local-name> > </search:element> > <search:top>10</search:top> > </search:value-facet> > > <search:value-facet id="journal-facet"> > <search:element> > <search:local-name>journal-title</search:local-name> > </search:element> > <search:top>10</search:top> > </search:value-facet> > > <search:value-facet id="article-type-facet"> > <search:element-attr> > <search:local-name>article</search:local-name> > <search:attr-local-name>article-type</search:attr- > local-name> > </search:element-attr> > <search:top>10</search:top> > </search:value-facet> > </facets> > > ------------------------------ > > Message: 5 > Date: Fri, 11 Jul 2008 09:40:14 -0700 > From: "Christopher Welch" <[EMAIL PROTECTED]> > Subject: RE: [MarkLogic Dev General] Lib search facets based search > To: "General Mark Logic Developer Discussion" > <[email protected]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii" > > On quick inspection it looks as if you didn't specify your namespaces on the > facet-def elements. > > Try prefixing all the facet-def elements with search:. > > > -----Original Message----- > From: Ashish Kumar [mailto:[EMAIL PROTECTED] > Sent: Friday, July 11, 2008 2:53 PM > To: '[email protected]' > Subject: Lib search facets based search > > 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 Frank Rubino Mark Logic Corp. 862-596-3248 [EMAIL PROTECTED] -- ------------------------------ Message: 3 Date: Tue, 15 Jul 2008 07:56:28 -0400 From: Frank Rubino <[EMAIL PROTECTED]> Subject: Re: [MarkLogic Dev General] RE: Lib search facets based search To: General Mark Logic Developer Discussion <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="US-ASCII" Ashish- You don't appear to have a namespace defined. Try: <search:value-facet id="kwd-facet"> > <search:element> <search:namespace>[the correct namespace]</search:namespace> > <search:local-name>kwd</search:local-name> > </search:element> > <search:top>10</search:top> > </search:value-facet> Then in search criteria: <facet-defs> <facet-def do-count="true"> <facet-def-id>kwd-facet</facet-def-id> </facet-def> </facet-defs> This should work. Frank On 7/15/08 12:26 AM, "Ashish Kumar" <[EMAIL PROTECTED]> wrote: > > Thanx for the reply, One thing I was missing here, I didn't define range > indexes. Even after defining range indexes through Admin interface, facet > search is not working for me. I still don't see any information in the > results. > > Any more clue. > I have tried prefixing search: also as suggested by Christopher. > > Regards, > /Ashish > ------------------------------ > > Message: 4 > Date: Fri, 11 Jul 2008 12:20:51 -0400 > From: Alan Darnell <[EMAIL PROTECTED]> > Subject: Re: [MarkLogic Dev General] Lib search facets based search > To: General Mark Logic Developer Discussion > <[email protected]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > Ashish, > > Here's the facet definition section in the lib-search-custom file that we > use and that works for us. Of course, we have range indexes defined for > each of the element or attributes we want to facet on. > > Alan > > <facets> > <default-do-count>true</default-do-count> > > <search:value-facet id="kwd-facet"> > <search:element> > <search:local-name>kwd</search:local-name> > </search:element> > <search:top>10</search:top> > </search:value-facet> > > <search:value-facet id="journal-facet"> > <search:element> > <search:local-name>journal-title</search:local-name> > </search:element> > <search:top>10</search:top> > </search:value-facet> > > <search:value-facet id="article-type-facet"> > <search:element-attr> > <search:local-name>article</search:local-name> > <search:attr-local-name>article-type</search:attr- > local-name> > </search:element-attr> > <search:top>10</search:top> > </search:value-facet> > </facets> > > ------------------------------ > > Message: 5 > Date: Fri, 11 Jul 2008 09:40:14 -0700 > From: "Christopher Welch" <[EMAIL PROTECTED]> > Subject: RE: [MarkLogic Dev General] Lib search facets based search > To: "General Mark Logic Developer Discussion" > <[email protected]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii" > > On quick inspection it looks as if you didn't specify your namespaces on the > facet-def elements. > > Try prefixing all the facet-def elements with search:. > > > -----Original Message----- > From: Ashish Kumar [mailto:[EMAIL PROTECTED] > Sent: Friday, July 11, 2008 2:53 PM > To: '[email protected]' > Subject: Lib search facets based search > > 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 Frank Rubino Mark Logic Corp. 862-596-3248 [EMAIL PROTECTED] -- ------------------------------ Message: 4 Date: Tue, 15 Jul 2008 10:39:09 -0700 From: David Amusin <[EMAIL PROTECTED]> Subject: [MarkLogic Dev General] Facebook XQuery Library To: <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="US-ASCII" All, Just wanted to let you all know that the Facebook XQuery library is now available on the Mark Logic developer website. Here is a link: http://developer.marklogic.com/code/#facebook If you have an instance of MarkLogic Server running on a machine outside of your firewall, then getting the sample application that comes with the library running takes approximately 10 minutes. Now is an exciting time to make a Facebook application as Facebook is rolling out the new version of their website within the next few weeks. I am excited to see what Facebook applications other Mark Logic developers will create and am enthusiastic about helping you with any challenges that come up, so don't hesitate to send an email to [email protected] about your work with the Facebook Platform and MarkLogic Server. Cheers, David -- David Amusin Software Engineer Mark Logic Corporation +1 650 207 2308 [EMAIL PROTECTED] This e-mail and any accompanying attachments are confidential. The information is intended solely for the use of the individual to whom it is addressed. Any review, disclosure, copying, distribution, or use of this e-mail communication by others is strictly prohibited. If you are not the intended recipient, please notify us immediately by returning this message to the sender and please delete all copies. ------------------------------ _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general End of General Digest, Vol 49, Issue 19 *************************************** _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
