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

Reply via email to