5 Replies Latest reply on Oct 5, 2012 7:18 PM by 966435

    Global Search


      I have a requirement as shown below.

      When user searches with productId/skuId in search box, then if the record exists in endeca then system has to redirect to Product details page.

      Please suggest me on this. Thanks in advance.
        • 1. Re: Global Search
          Michael Peel-Oracle
          Assuming Sku ID and/or Product ID is unique, then:

          If ( results.getNavigation() != null && results.getNavigation().getTotalNumberERecs() == 1 ) {
          String uniqueId = results.getNavigation().getERecs().get(0).getProperties().get("P_My_Unique_ID_for_my_Web_Application");
          // Forward to product page for specific product

          If you are using aggregated records, replace getTotalNumberERecs() with getTotalNumberAggrERecs(), and getERecs().get(0) with getAggrERecs().get(0).getRepresentative() .

          • 2. Re: Global Search
            Thanks michael for the response.

            Currently i am using ATG 10.1.1 with experience manager, As it uses the AssmblerPipelineServlet for processing the content items for pages( configured in experience manager) My question is do i need to have this recordcount check in AssmblerPipelineServlet.
            • 3. Re: Global Search
              Michael Peel-Oracle
              No idea how you would technically implement this using Assembler - I've not used it yet. Hopefully someone else can help!

              • 4. Re: Global Search
                sean horgan - oracle
                You could start by taking a look at the discover electronics app, specifically the jsp & js under WEB-INF/views/desktop/SearchBox. You can see examples on processing dimension search results. Similar to the presentation API, you can examine the response to see if there was just one result and build an action string to point at a detail page.

                • 5. Re: Global Search
                  The application code would be similar in the Assembler context, with slightly different syntax. In the case of Assembler, you'll be looking in the contents of the returned ResultsList (com.endeca.infront.cartridge.ResultsList):

                  if (resultsList.getRecords() != null && resultsList.getRecords().size() == 1) {
                  String uniqueId = resultsList.getRecords().get(0).getAttributes().get("P_My_Unique_ID_for_my_Web_Application").get(0);
                  // Forward to product page for specific product