Topic
13 replies Latest Post - ‏2013-10-02T14:22:33Z by erkekserkan
SystemAdmin
SystemAdmin
2014 Posts
ACCEPTED ANSWER

Pinned topic WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

‏2010-02-18T03:22:17Z |
Hi,
We are using Websphere portal 6.1.0.2 and Omnifind 8.5 FP4. Omnifind (ES portlet) is configures to portal successfully and able to search from search bar and results are displaying in the ES portlet that is on a portal page.
But if I want to use this setup on a virtual portal, what changes should be done. I have created a page ibm.portal.essearch and cloned ES portlet as ibm.portal.essearch.called and this portlet to the page
Updated on 2011-02-03T23:51:09Z at 2011-02-03T23:51:09Z by dlee112
  • SystemAdmin
    SystemAdmin
    2014 Posts
    ACCEPTED ANSWER

    Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

    ‏2010-02-18T03:26:19Z  in response to SystemAdmin
    Updated the file "portalSearchBar.jsp" to include the page and portlet unique names in the virtual portal along with /myportal/<nameoftheVirtualPortal>. This setup is not working, getting exception like object id of <page> or <Portlet> is unknown.

    Please any help on this.
  • cjin
    cjin
    22 Posts
    ACCEPTED ANSWER

    Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

    ‏2010-02-18T07:07:20Z  in response to SystemAdmin
    First of all, keep in mind that the ES Search Application, the search portlet (including portalSearchBar.jsp) shipped in OEE are meant to be sample applications to show how search app and portlet can be developed. The source code for these sample apps are also shipped in OEE under <install directory>\samples\ESSearchApplication.

    The default sample es search portlet does not have support for virtual portals. You need to customize it so have support for virtual portal. Below is just one example how you can customize it.

    In OEE 8.5, "banner_searchControl.jspf" redirects the request to "/wps/omnifind/portalSearchBar.jsp". And "portalSearchBar.jsp" generates URL of OmniFind search page (where ESSearchPortlet is deployed) and redirects the request to OmniFind page. This is how the end user can get to the OmniFind page. "portalSearchBar.jsp" uses unique name "ibm.portal.OmniFindSearch" to look for the OmniFind page on Portal like:

    String url = ESURLGenerator.generateUrlString("ibm.portal.OmniFindSearch","ibm.portal.OmniFindSearch.called", "/myportal", request, response);

    This works. However, it will search the unique name in a non-Virtual portal environment. So if you deploy ESSearchPortlet on virtual portal, portalSearchBar.jsp cannot find it.
    To solve this problem in a virtual portal environment, portalSearchBar.jsp needs to use Object ID, not unique name of the OmniFind page. But Object ID of the OmniFind page depends on the portal environment and varies under each portal deployment. So first, you have to find Object ID of the OmniFind page in your virtual portal environment using Portal xmlaccess script:

    Here is the sample script (omni.xml):

    <?xml version="1.0" encoding="UTF-8"?>
    <request
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="PortalConfig_1.4.xsd"
    type="export">
    <portal action="locate">
    <content-node action="export" uniquename="ibm.portal.OmniFindSearch" />
    </portal>
    </request>

    And you can get ObjectID using the following command.
    $ "C:\IBM\WebSphere\PortalServer\bin\xmlaccess.bat" -user <username> -password <password> -in omni.xml -url http://<portal server>:<portalport>/wps/config/<virtual portal context>

    The result looks like:
    <content-node action="update" active="true" allportletsallowed="false" content-parentref="6_AFKO8B1A0817002RPM3PDV3001 create-type="explicit" domain="rel" objectid="6_AFKO8B1A0OG1802RPFPBRF10G0" ordinal="3600" type="page" uniquename="ibm.portal.OmniFindSearch">
    ...
    ...
    ...
    <component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_AFKO8B1A0OG1802RPFPBRF10G6" ordinal="100" orientation="H" type="container" width="undefined">
    <component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_AFKO8B1A0OG1802RPFPBRF10G1" ordinal="100" type="control" uniquename="ibm.portal.OmniFindSearch.called" width="undefined">
    <portletinstance action="update" domain="rel" objectid="5_AFKO8B1A0OG1802RPFPBRF10G5" portletref="3_AFKO8B1A0OG1802RPFPBRF1006"/>
    </component>
    </component>

    After that we can get ObjectID "6_AFKO8B1A0OG1802RPFPBRF10G0" for "ibm.portal.OmniFindSearch" page and "7_AFKO8B1A0OG1802RPFPBRF10G1" for "ibm.portal.OmniFindSearch.called" portlet.
    Using these Object ID, you have to update portalSearchBar.jsp to generate URL. It is written in portal technote (http://www-1.ibm.com/support/docview.wss?rs=688&ca=portall2&uid=swg21271209). And the following code is sample portalSearchBar.jsp:

    <%@ page import="com.ibm.es.searchui.portal.utils.ESServerContext" %>

    <%@ page import="java.io.StringWriter" %>
    <%@ page import="java.util.Map" %>
    <%@ page import="java.util.Enumeration" %>

    <%@ page import="javax.naming.Context" %>
    <%@ page import="javax.naming.Name" %>
    <%@ page import="javax.naming.CompositeName" %>
    <%@ page import="javax.naming.InitialContext" %>

    <%@ page import="com.ibm.portal.ObjectID" %>
    <%@ page import="com.ibm.portal.identification.Identification" %>
    <%@ page import="com.ibm.portal.state.Constants" %>
    <%@ page import="com.ibm.portal.state.EngineURL" %>
    <%@ page import="com.ibm.portal.state.StateManager" %>
    <%@ page import="com.ibm.portal.state.service.StateManagerHome" %>
    <%@ page import="com.ibm.portal.state.accessors.url.URLAccessorFactory" %>
    <%@ page import="com.ibm.portal.state.accessors.selection.SelectionAccessorFactory" %>
    <%@ page import="com.ibm.portal.state.accessors.selection.SelectionAccessorController" %>
    <%@ page import="com.ibm.portal.state.accessors.portlet.PortletAccessorFactory" %>
    <%@ page import="com.ibm.portal.state.accessors.portlet.PortletAccessorController" %>
    <%
    request.setCharacterEncoding("UTF-8");
    if (request.getParameter("q") == null && request.getParameter("query") != null) {
    String query = request.getQueryString();
    String newQuery = query.replaceFirst("query=", "q=");
    response.sendRedirect(request.getRequestURL().append("?" + newQuery).toString());
    } else {
    try {
    // String url = ESURLGenerator.generateUrlString("ibm.portal.OmniFindSearch", "ibm.portal.OmniFindSearch.called", "/myportal", request, response);
    String pageNameId = "6_AFKO8B1A0OG1802RPFPBRF10G0";
    String portletNameId = "7_AFKO8B1A0OG1802RPFPBRF10G1";
    String path = "/myportal/<virtual portal>";

    Context ctx = new InitialContext();
    Name ctxName = new CompositeName("portal:service/Identification");
    Identification identification = (Identification)ctx.lookup(ctxName);

    ObjectID pageName = identification.deserialize(pageNameId);

    ctxName = new CompositeName("portal:service/Identification");
    identification = (Identification)ctx.lookup(ctxName);
    ObjectID portletName = null;
    if (portletNameId != null) {
    portletName = identification.deserialize(portletNameId);
    }
    StateManagerHome home = (StateManagerHome)ctx.lookup("portalservice/com.ibm.portal.state.StateManager");
    StateManager mgr = home.getStateManager();

    // Get the URL factory
    URLAccessorFactory urlFactory = (URLAccessorFactory) mgr.getAccessorFactory(URLAccessorFactory.class);

    // Request a URL
    // The 3rd argument specifies whether the URL points to the protected
    // (authenticated) area;
    // pass in "false" if your page is accessible for unauthenticated users
    EngineURL url = urlFactory.newURL(new ESServerContext(request, path), false,
    false, mgr.newState(), Constants.EMPTY_COPY);

    // Set the page this URL should point to
    SelectionAccessorFactory selectionFactory = (SelectionAccessorFactory) mgr.getAccessorFactory(SelectionAccessorFactory.class);
    // Request the selection controller to set the page; pass in the state
    // associated with the created URL
    SelectionAccessorController selectionCtrl = selectionFactory.getSelectionController(url.getState());
    // Set the page; you need the unique name (String) or the ObjectID of
    // that page
    selectionCtrl.setSelection(pageName);
    // Dispose the accessor (avoids memory leak)
    selectionCtrl.dispose();

    if (portletName != null) {
    // Set portlet render parameters
    PortletAccessorFactory portletAccessorFactory = (PortletAccessorFactory) mgr.getAccessorFactory(PortletAccessorFactory.class);
    // Get the portlet controller to set render parameters; pass in the
    // state associated with created URL
    PortletAccessorController portletCtrl = portletAccessorFactory.getPortletController(portletName, url.getState());

    // Get the modifiable render parameter map
    Map parameters = portletCtrl.getParameters();
    // Set the render parameter
    Enumeration keys = request.getParameterNames();
    while (keys.hasMoreElements()) {
    String key = (String) keys.nextElement();
    String value = request.getParameter(key);
    parameters.put(key, new String[] { value });
    }
    // Dispose the accessor (avoids memory leak)
    portletCtrl.dispose();
    }

    // Now convert the URL to a String; pass in your writer.
    // writeDispose() writes the URL to the given writer and disposes the
    // URL afterwards.
    // If you want to display this URL a multiple times pls use writeCopy().
    String redirectUrl = url.writeDispose(new StringWriter()).toString();

    response.sendRedirect(redirectUrl);
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    %>


    The above portalSearchBar.jsp can generate URL on virtual portal. You should now be able to use the Search Bar on virtual portal environment.
    • SystemAdmin
      SystemAdmin
      2014 Posts
      ACCEPTED ANSWER

      Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

      ‏2010-02-18T14:52:26Z  in response to cjin
      Hi Cjin,

      Thanks for the reply. I will implement this today.

      Srini
      • SystemAdmin
        SystemAdmin
        2014 Posts
        ACCEPTED ANSWER

        Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

        ‏2010-02-18T16:55:01Z  in response to SystemAdmin
        Hi Cjin,

        Thanks for the code. This time, when I enter search string in the search bar and click search button, it is going the ES page and portlet in the virtual portal , but it seems like porlet is not taking the search query, it is not displaying any search results.

        Thanks,
        Srini
  • SystemAdmin
    SystemAdmin
    2014 Posts
    ACCEPTED ANSWER

    Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

    ‏2010-02-18T17:00:14Z  in response to SystemAdmin
    unanswered
  • cjin
    cjin
    22 Posts
    ACCEPTED ANSWER

    Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

    ‏2010-02-18T17:58:52Z  in response to SystemAdmin
    Did you follow the OEE 8.5 documentation updates regarding "Configuring the WebSphere Portal version 6.1 Search bar to use enterprise search"?

    The OEE 8.5 documentation updates are at:

    http://www-01.ibm.com/support/docview.wss?uid=swg21308220

    Then scroll down to the section of "Configuring the WebSphere Portal version 6.1 Search bar to use enterprise search".
    • SystemAdmin
      SystemAdmin
      2014 Posts
      ACCEPTED ANSWER

      Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

      ‏2010-02-22T23:17:54Z  in response to cjin
      Hi Cjin,

      I have followed the documentation. When I used the default portalSearchBar.jsp, it is working for both parent portal and virtual portal giving results in the same page of parent portal, but when I used the code mentioned by you, when I click the search button after entering the search query, then the navigation is going to the virtual portal search page where ESPortlet is configured, but it is not showing any results. Portlet is behaving like, it is not received any query.

      Thanks,
      Srini
  • cjin
    cjin
    22 Posts
    ACCEPTED ANSWER

    Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

    ‏2010-02-22T23:56:11Z  in response to SystemAdmin
    I believe you already opened a PMR, correct? If so, I will let product support team handle it. If not, please open a PMR to engage product support.
    • SystemAdmin
      SystemAdmin
      2014 Posts
      ACCEPTED ANSWER

      Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

      ‏2010-02-23T22:14:38Z  in response to cjin
      Hi Cjin,

      any help/directions on this? IBM is taking time to solve this.

      Thank,
      Srini
  • cjin
    cjin
    22 Posts
    ACCEPTED ANSWER

    Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

    ‏2010-02-23T22:49:42Z  in response to SystemAdmin
    I'm also part of the OEE product support team. I see you already opened a PMR last Friday and we have been working with you on it. So let the support process take over to investigate the issue.
    • SystemAdmin
      SystemAdmin
      2014 Posts
      ACCEPTED ANSWER

      Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

      ‏2010-03-06T21:18:19Z  in response to cjin
      This one is solved with the help of IBM.

      Thanks Cjin.

      Srini
      • dlee112
        dlee112
        1 Post
        ACCEPTED ANSWER

        Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

        ‏2011-02-03T23:51:09Z  in response to SystemAdmin
        Hi Srini,

        I have the same problem with no queries being passed through and hence no search results - would you be able to share the solution?

        Many thanks

        David
      • erkekserkan
        erkekserkan
        5 Posts
        ACCEPTED ANSWER

        Re: WebSphere Portal 6.1 search bar-Omnifind Enterprise portlet-VirtualPortal

        ‏2013-10-02T14:22:33Z  in response to SystemAdmin

        Hi Srini,

        I have the same problem, I changed the page of the search portlet and now no queries being passed through new page, can you share the solution?

         

        Thanks.

        Serkan