Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
ted_ueda
Employee
Employee

>

I'm a Senior Support Engineer with the SAP Business Intelligence SDK Support Group, specializing in the SDKs provided with SAP BusinessObjects Enterprise, Crystal Report, and Web Intelligence.

+My particular interests are in new functionalities, little-known or not-well-documented corners of the SDK, and curiousities that I occasionally come across in my daily life as a Support Guy. </p><p>You're welcome to suggest a topic for me to discuss - I'm always on the hunt for the shiny new or the strange and wonderful.+   

 

Platform Search in SAP BusinessObjects Enterprise

SAP BusinessObjects Enterprise BI 4.0 introduces Platform Search, a vastly enhanced and improved search framework over the XI 3.x Content Search.  Redesigned from the ground up, the two components that make up the framework - indexer and query engine - now has all the features you expect from a robust search platform.

The  indexer for your Business Intelligence content - Crystal Reports, Web Intelligence, and PDF and other file formats - now works continuously as new content is added.  Furthermore, you can add more search services, to scale up performance as the volume of your content grows.  The query engine has capabilities such as filtering your search results along common categories, and suggesting alternate query terms if your query returns no results. 

You can read all about it in Chapter 17 of the SAP BusinessObjects Enterprise BI 4.0 Administrator's Guide  (http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_bip_admin_en.pdf).

What's truly exciting is how it adds a different paradigm in how you organize your Business Intelligence documents.  

I don't think I'm the only BI consumer who often becomes frustrated trying to find that one important report needed to accomplish some task.  This frustration never really goes away, and here's the reason why.  As business needs evolve, reports essential in capturing BI also evolves, and this invariably leads to a profusion of many many reports.  The reports you looked at last year, or last quarter, may no longer apply now.  

One organizes these reports in SAP BusinessObjects Enterprise using the Folder/Category paradigm.  This hierarchical organization has several advantages: it's intuitive and easy to use by most users, it allows for clear inheritance path of rights, and can manage a tremendous number of objects, since the tree structure allows for only a few objects to be visible at one time.   The disadvantage is that, well, we use it to manage a tremendous number of objects.  

Take my "My Documents" folder.  Please.  Honestly, I couldn't tell you how many files, text, email, images, documents, etc etc etc I have there.  I couldn't even tell you how many subfolders I have there.  If you ask me to find a file in there by clicking on each folder to see if it's there, it'll take me +hours+.

But I just don't really care.  Why?  Whenever I need to find something, I use Desktop Search.  

Point here is that the typical BusinessObjects Enterprise Folder organization of even your small enterprises are much bigger and complex than my little ol' Desktop.  And with the number of report writers, managers, document consumers there are in your typical organization, and how people change roles frequently (or take on more roles), trying to organize the folder structure is extremely difficult. 

To help the BI consumer comes Platform Search - now, they can enter keywords or relevant phrases, and the search framework will find them the relevant document. 

This adds an onus on the report designer, of course - they have to create reports with search in mind: add relevant keywords, give the document descriptive text both in its content and metadata, or ensure non-essential information doesn't appear in the document such that they don't show up as irrelevant search hits.

It's a new way of thinking about and organizing your BI.

What's really exciting to me is that the query engine is exposed to custom coders and integrators in two ways: via (1) public API, and (2) OpenSearch   (http://www.opensearch.org/Home)provider.

In this blog, I'll discuss the first option - the Platform Search API.  In a future blog entry, I'll discuss OpenSearch.

Platform Search API Sample Code

The Platform Search API is part of the SAP BusinessObjects Enterprise Java SDK, for which you can find on-line the Developer Guide  (http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_boejava_dg_en.zip) and on-line JavaDocs  (http://help.sap.com/javadocs/bip/40/bip/en/index.html).   The API integrates into the Enterprise Java SDK quite seamlessly - it's just another service with methods invoked via the Corba-based Enterprise Framework.  <!--

body

#mainContainer

.infoTbl


.infoTbl td .formField

.infoTbl td .credText {
    font-size: 0.8em;
}

.infoTbl td .credField {
    font-size: 0.8em;
    width:20em;
    border:1px solid #ccc;
}

.btn

#suggestion {
    font-style: italic;
    font-size:0.7em;
}

#hits {
    font-size:1em;
}

#description {
    font-size:0.8em;
}

#kind

#owner

#path

.highlight {

    font-weight:bold;

}

></mce:style><style  type="text/css" mcebogus="1"><!

body

#mainContainer

.infoTbl


.infoTbl td .formField

.infoTbl td .credText {
    font-size: 0.8em;
}

.infoTbl td .credField {
    font-size: 0.8em;
    width:20em;
    border:1px solid #ccc;
}

.btn

#suggestion {
    font-style: italic;
    font-size:0.7em;
}

#hits {
    font-size:1em;
}

#description {
    font-size:0.8em;
}

#kind

#owner

#path

.highlight {

    font-weight:bold;

}

-->

<%

/*

  • Modify the following entries to conform to your deployment.

*/

String openDocumentURL = "http://localhost:8080/BOE/OpenDocument/opendoc/openDocument.jsp";

String cmsName = "localhost";

String authType = "secEnterprise";

Locale locale = Locale.US;

String username;

String password;

IEnterpriseSession enterpriseSession = null;

String logonToken = null;

IInfoObjects infoObjects = null;

String searchQuery = null;

PropertyBag suggestionBag = null;

/*

  • Retrieve the query string.

*/

searchQuery = request.getParameter("bo_search_query");

searchQuery = (searchQuery == null) ? "" : searchQuery;

/*

  • If the request contains user credentials, attempt logon.

*/

username = request.getParameter("bo_username");

username = (username == null) ? "" : username;

password = request.getParameter("bo_password");

password = (password == null) ? "" : password;

if(username.trim().length() > 0) {

    try {

        enterpriseSession = CrystalEnterprise.getSessionMgr().logon(username,

                password, cmsName, authType);

    } catch(java.lang.Exception e_fall_through_ok) {

    }

}

/*

  • If no or unsuccessful logon, try retrieving a valid EnterpriseSession

  • from HTTP Session.

*/

if(enterpriseSession == null) {

    enterpriseSession = (IEnterpriseSession) session.getAttribute("EnterpriseSession");

    if(!isEnterpriseSessionValid(enterpriseSession)) {

        enterpriseSession = null;

    }

}

/*

  • Store EnterpriseSession in HTTP Session.

*/

session.setAttribute("EnterpriseSession", enterpriseSession);

/*

  • If there is a valid EnterpriseSession, then generate WCA token for OpenDocument URL

  • and return result of search query from the Platform Search service.

*/

if(enterpriseSession != null) {

    try {

        IPlatformSearchService platformSearchService;

        SearchIndexResponse searchIndexResponse;

        logonToken = enterpriseSession.getLogonTokenMgr().createWCAToken("", 20, 10);

        platformSearchService = (IPlatformSearchService)

                enterpriseSession.getService("PlatformSearchServiceOCA");

        searchIndexResponse = platformSearchService.fullSearch(searchQuery, locale);

        suggestionBag = searchIndexResponse.getSuggestionBag();

        infoObjects = searchIndexResponse.getHitObjects();

    } catch(java.lang.Exception e_fall_through_ok) {}

}

/*

  • Print out the search query text entry field, and if needed, the

  • user credentials fields.

*/

%>

<%

/*

  • Print out query suggestions if any.

*/

if(suggestionBag != null && suggestionBag.getInt("SI_TOTAL") > 0) {

%>

<div id="suggestion"> Did you mean
   
<%
    for(Iterator<Property> isuggestion = suggestionBag.allIterator(); isuggestion.hasNext(); ) {
        PropertyBag suggestion;
        String suggestionQuery;
        String suggestionText;

        suggestion = isuggestion.next().getPropertyBag();  
        suggestionQuery = suggestion.getString("SI_HIT_QUERY");
        suggestionText = suggestion.getString("SI_HIT_TEXT");
        if(suggestionText != null) {
%>
            [" ><%= suggestionText %> | ?bo_search_query=<%= suggestionQuery %>]
<%
        }

    }
%>
    ?
    </div>

<%

}

/*

  • Print out search results if there are any.

*/

if(infoObjects != null) {

    for(IInfoObject infoObject : (List<%!

/*

  • Return true only if the EnterpriseSession is valid.

*/

boolean isEnterpriseSessionValid(IEnterpriseSession enterpriseSession) {

    IInfoStore infoStore;

    if(enterpriseSession == null) {

        return false;

    }

    /*

  • Send simplest invalid query to CMS to force SDKServerException if

  • EnterpriseSession is valid.

     */

    try {

        infoStore = (IInfoStore) enterpriseSession.getService("", "InfoStore");

    } catch(java.lang.Exception e) {

        return false;

    }

    try{

        infoStore.query("");

    } catch(SDKServerException sse) {

        return true;

    } catch(java.lang.Exception e) {

        return false;

    }

    throw new RuntimeException("Well, this is embarrasing. You weren't meant to see this.");

}

%>

If you want your own copy, click into the text area below and select-all (Ctrl-A), copy and paste into your favorite text editor.  Deploy the JSP file into your web application, following the Enterprise Java SDK Developer Guide as to the required jar files (Note:  at the time I'm writing this, the list of required jars in the Developer Guide is missing three files necessary for Platform Search API - platformsearchsdk.jar, platformsearchsdkcommon.jar and xpp3-1.1.3_8.jar.  Make sure you have these jars deployed in your app). 

Have a look at the code - it's quite short.  Edit the top part of the JSP to specify the openDocumentURL and cmsName variable values to conform with your own deployment.  Now if you deploy the JSP and run it in a browser, you'll see a page with a search text entry field and user credential fields.  Enter a valid secEnterprise credential and a search query, then click the "Search" button.  You'll see output that looks like this:

The screenshot shows results from searching for "Sales" in my out-of-the-box BI 4.0 deployment,  Documents are listed in order of relevance, with their name, description, type, owner and folder path.  Clicking on the name will bring up a web browser with an OpenDocument URL reporting link keyed to the document CUID value.  Interestingly, you see that the search term "Sales" is bold-faced when it appears in the document name and description.  Highlighting of phrases matching the query is one of the features of this API.

Now try entering a query, but with a typo - instead of "Crystal", I enter "Krystal".  Here's what you see:

No documents match, so no results are displayed.  However, a search suggestions 'crystal' and 'coastal' are displayed.  The suggestions come from the Platform Search service itself - when it cannot find any matching document, it searches the indexer for words that closely matches the entered query, and returns that. 

I've coded the JSP such that clicking on a suggested word runs the search again, but with the suggested word:

It returns the matching document, where the query term is again highlighted by boldface.

Let's register the sample code as a Internet Explorer's search provider.  Go to http://www.ieaddons.com/ca/createsearch.aspx  (http://www.ieaddons.com/ca/createsearch.aspx) and enter the URL to your JSP deployment, with HTTP GET parameter bo_search_query=TEST, and give it the name "SAP BusinessObjects Enterprise BI 4.0 Platform Search".  For my deployment, the URL looks like "http://lmaurinst01:8080/bi40/Java_Enterprise_BE14_Platform_Search/search.jsp?bo_search_query=TEST".  Then install the search provider.  Before closing the browser, click "View XML", and you should see a file that looks like this:</p>bq. search.xml<br />

    <Url type="text/html" template="http://lmaurinst01:8080/bi40/Java_Enterprise_BE14_Platform_Search/search.jsp?bo_search_query=" />

This XML defines an OpenSearch-compliant Search Provider - you can publish this XML to the IE add-on web page, and make it available to other people.  

Now, you can click the IE Search Provider icon (the magnifying glass) and select the "SAP BusinessObjects Enterprise BO 4.0 Platform Search" that you just registered:

Enter a search term in the IE search text field and you'll see something like this:

The query is sent to the search page.  I really like having this Search Provider there! Now, I don't need to log onto BI launchpad (the new name for InfoView) to utilize search - it's always there when I need it.  Clicking on the search result bring up the document via OpenDocument URL reporting.

!https://weblogs.sdn.sap.com/weblogs/images/251913699/search_query_opendocument.jpg|height=415|alt=im...!</body>

1 Comment