Search code examples
marklogic

Multifacets value selection


I need to implement in Marklogic a multi-facet selection navigation system. The problem is that when I select a value V1 in a facet F1, the facet returned in the facet-results includes only the value v1 and ommits the other values (I use the serach API with constraint options). Is there a way to say to the search API to return all values in the facet independing on the selected value.

Note that I have multiple facets abd so the values returned need to be adapted the selected filters/values.

Here is my query when I select a value:

 search:{    options: { 
    constraint : [{name:'n1',...}, {name:'n2',...}, {name:'n3',...},...]   },   qtext: "the text query",   query: {
     and-query:{
       queries:[range-constraint-query:{constraint-name:"n1",....}]
     }   } }

Solution

  • If you are using Server-Side JavaScript, rather than XQuery, the JSearch API has an "othersWhere" capability that I think might meet your needs. Take a look at http://docs.marklogic.com/guide/search-dev/javascript#id_88888.