Hi Collen, Thanks for your quick reply. My requirement is to view only facets based on the options configured and to change the default structure i am getting.
Default structure: <search:response xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:search="http://marklogic.com/appservices/search" snippet-format=" snippet" total="75207"start="1" page-length="10"> <search:facet name="lesson" type="xs:string"> <search:facet-value name="" count="33951"/> <search:facet-value name="Addition and Subtraction" count="733">Addition and Subtraction</search:facet-value> <search:facet-value name="All About Matter" count="68">All About Matter </search:facet-value> <search:facet-value name="Animals" count="54">Animals</search:facet-value> Customized structure: i want to change the above structure for "name" attribute i am trying to display sequence number(1,2,3---) and for "value" i am trying to concat some values. Can i achieve the above requirement using custom constarints or is there any other options to proceed on this? Thanks, Manoj. On Thu, Jul 18, 2013 at 8:27 PM, Colleen Whitney < colleen.whit...@marklogic.com> wrote: > Hi Manoj, > > What custom constraints allow you to do is provide your own code that > plugs in to do string parsing and faceting in your own way, while still > taking advantage of other parts of the underlying API. > > The <parse> tag lets you plug in code to tell the parser how to construct > queries from tokens that start with "lesson:" (because that's your > constraint name). The <start-facet> (which you're not using here) lets you > specify how to extract a list of values for your facet; and the > <finish-facet> tags let you customize how those values should be processed. > Those two steps are treated separately, because doing so lets the API > parallelize the calls that extract the values. > > So these are all "hooks" for customizing the meaning of "lesson" in the > search grammar. > > To figure out what might be happening, I think we need a little more > information. What custom behavior are you trying to accomplish with your > facets? What might help most is that you're referencing custom code in > facets.xqy...can you share that code? Did you install the code on the > server? And when you get no results, are you seeing any error messages? > > --Colleen > > > ------------------------------ > *From:* general-boun...@developer.marklogic.com [ > general-boun...@developer.marklogic.com] on behalf of manoj viswanadha [ > manoj.viswana...@gmail.com] > *Sent:* Thursday, July 18, 2013 3:39 AM > *To:* MarkLogic Developer Discussion > *Subject:* [MarkLogic Dev General] Creating custom facets using custom > constarints in Rest API > > Hi all, > > I am exploring the options of creating custom facets. I got the option > of using custom constarints mentioned in REST API document. > > I am using the below options: > > < constraint name="lesson"> > < custom facets="true"> > < parse apply="parse" ns= " at="/facets.xqy" /> > > <finish-facet apply="finish-facet" > ns="http://marklogic.com/rest-api/transform/facets" at="/facets.xqy"/> > </search:custom> > <range collation="http://marklogic.com/collation//S2" > type="xs:string" facet="true"> > <facet-option>ascending</facet-option> > <facet-option>limit=10</facet-option> > <path-index>*:level[@level_number=2]/*:title</path-index> > </search:range> > </constraint> > > The Service i am calling is: > > http://localhost:portno > /v1/search?q=&options=test&format=xml&collection=Resources&view=facets > > When i use custom option i am not getting results and when i remove > custom option i am able to get results. Does custom constraints work for > facets? > > Can anyone help me in this. I want to change the default structure of > facets. > > Thanks in advance, > Manoj. > > _______________________________________________ > General mailing list > General@developer.marklogic.com > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general