0 Replies Latest reply on Jul 13, 2007 9:36 AM by 441615

    UltraSearch API : Document.getUrl() : returns URL of Portal Items, not Page


      I am new to UltraSearch & I have managed to set up an instance, define the Sources and define a Scheduler to search the Sources. I am trying to build an application that uses the UltraSearch APIs to connect to the Instance & retrieve the Search Results.

      I am using Oracle UltraSearch I have set up an UltraSearch Source to crawl through the Public Pages in my Oracle Portal Instance.

      Here's the code snippet that I use :-
      public ArrayList getSearchResults(String strKeyword)
           String strMethodName = "getSearchResults";
           ArrayList alSearchResults = new ArrayList();
           Instance         objUltraSerachInstance      = null;
           InstanceMetaData objInstanceMetaData         = null;
           Query            objQuery                    = null;
           Result           objResult                   = null;
           Document         objDocument                 = null;
           UltraSearchResultsBean objUltraSearchResultsBean = null;
           Log.info(" Ultra "+":"+strClassName+":"+strMethodName+" Entering the Method ");
           strKeyword = strKeyword == null ? "" :strKeyword;
            objUltraSerachInstance = new Instance();
            objUltraSerachInstance.setCloseConnection(false) ;
            objInstanceMetaData = objUltraSerachInstance.getMetaData();
            objQuery  = new Contains(strKeyword, objInstanceMetaData);
            objResult  = objUltraSerachInstance.getResult(objQuery, Locale.ENGLISH, 1, 10, null, null, null, true);
            for(Iterator iterator = objResult.iterator(); iterator.hasNext();)
                objUltraSearchResultsBean = new UltraSearchResultsBean();
                objDocument = (Document)iterator.next();
                objUltraSearchResultsBean.setId( objDocument.getId() );
                objUltraSearchResultsBean.setScore( objDocument.getScore());
                objUltraSearchResultsBean.setUrl( objDocument.getUrl() );
                objUltraSearchResultsBean.setLastModified( objDocument.getLastModified() );
                objUltraSearchResultsBean.setExcerpt( objDocument.getExcerpt() );
           Log.info("  Ultra "+":"+strClassName+":"+strMethodName+" alSearchResults "+alSearchResults);
           catch (Exception objException)
              Log.severe("  Ultra  "+":"+strClassName+":"+strMethodName+" Exception :: ",objException);
           Log.info("  Ultra  "+":"+strClassName+":"+strMethodName+" Leaving the Method ");
           return alSearchResults;
      I have a problem with this code - the getUrl() method returns the URLs of the Text Items in Portal, but not the Portal Page URL itself. As a result, when the user clicks on the HyperLinked URL, the Text item is shown out of context of the Page that contains it.

      I have even tried to limit the Crawler depth in an attempt to control this, but I am unable to do so.

      Can anyone please help me with this ? Is there a way to limit the search in UltraSearch to the Portal Page Level, instead of the Item Level ?

      Our Client wants to leverage UltraSearch with Portal & we have had successes with Oracle Database Tables. We are now facing a problem with only the Portal Pages.

      Our Application will ultimately be converted into a reusable J-PDK Portlet.

      Please do let me know if I need to include any other information.

      Sandeep Seshan