3 Replies Latest reply on Mar 25, 2014 2:38 PM by JaniceM

    How to apply Refinement Filters through API

    varkashy

      Hi All

       

      I have a certain requirements where in i need to apply RefinementFilters through API in Endeca studio 3.0.

      I went through different docs on endeca studio and could see

      Provided QueryFunction filter classes

      In this doc that its mentioned to create refinement filter as

      RefinementFilter refinementFilter = new RefinementFilter("1999", "Year");

      I am able to create the object and i am applying this to the request as

      refinementFilter .applyToDiscoveryServiceQuery(query.getDiscoveryServiceQuery());

      But what this is doing is, its filtering the data , but not showing the refinement in the breadcrumbs. I have tried lot of different ways but i am stuck at this part. Can some one please explain what i am doing wrong and how to fix this?

        • 1. Re: How to apply Refinement Filters through API
          JaniceM

          I asked a developer, and apparently what you are doing is calling your function directly, when you should just be adding it to the query state.

           

          Use the instructions here:

           

          Obtaining query results

           

          If I understood correctly, you need to use the first three lines of code at the top of this topic, replacing NavConfig with your RefinementFilter.

          1 person found this helpful
          • 2. Re: How to apply Refinement Filters through API
            varkashy

            Hi Janice

             

            Thanks a lot for your response, this indeed helped me.

            However, i am still facing an issue. When i add the function to querystate , its not reflecting at the same time. I mean i don't see breadcrumbs still, but when i select a new refinement, both earlier selected and the new one are coming.

             

            To give more context, i have overridden default security manager and i am invoking this code in the custom security manager class as

             

            public void applySecurity(PortletRequest request, MDEXState mdexState, Query query) throws MDEXSecurityException {

            .

            .

            .

            .

            In this method i am invoking as

            RefinementFilter refinementFilter = new RefinementFilter("1999", "Year");

                                        QueryState qt=mdexState.getQueryState();

                                        qt.addFunction(newFilter);

                                        mdexState.setQueryState(qt);

             

            When the endeca studio page loads the refinement gets reflected but the breadcrumb portlet doesn't show the filter. If i select any other refinement on the page both filters are coming.

             

            Could you guide what i am missing here?

            • 3. Re: How to apply Refinement Filters through API
              JaniceM

              I asked my dev resource again - it looks like what you have is correct, but somehow the Breadcrumbs component is not being refreshed when you load the page. It may require additional debugging.

               

              That's pretty much all the help I can provide from here.

               

              If it still doesn't work, you may want to contact support for more extensive help.

               

              Or if someone else on the forum has more experience with custom development in Studio, they may have a better idea.