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: [email protected] 
[[email protected]] on behalf of manoj viswanadha 
[[email protected]]
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
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to