2 Replies Latest reply: Mar 17, 2014 11:10 AM by rowrig RSS

    Retrieving the Full Path of the Document / Folder in Search results

    User567201-OC

      Hello,

       

      We have a custom portlet to perform search in knowledge directory. We are able to retrieve the results from knowledge directory and would like to know on one enhancement feature.

      Would like to know if it is possible to retrieve the directory structure / path of the document / folder. Something like "\Knowledge Directory\Customer Service\...." I have seen this path come up in search results when using Portal Admin. Not sure if it is available when using the idk.dll

       

       

      Below is a sample code in C#. Would you know if there is a way I can retrieve the directory strcuture. If so, what method would give me that value? I tried GetURL, but that gives me the URL of the document http://portal/.....as compared to the path.

       

       

      ===== 

      using Plumtree.Remote.Portlet; 

      using Plumtree.Remote.PRC; 

      using Plumtree.Remote.PRC.Search;

       

       

      //Establishing Session with Portal

      IRemoteSession session = RemoteSessionFactory.GetExplicitLoginContext(new Uri(portletPortalAPIPref), username, password);

      ISearchFactory searchFactory = session.GetSearchFactory();

      searchRequest = searchFactory.CreatePortalSearchRequest();

      searchRequest.SetQuery(txtSearchText.Text);

       

       

                  //Setting up the Search Parameters – Objects to Search, Order By, Number of Results

        ObjectClass[] objectTypes = { ObjectClass.Document, ObjectClass.DocumentFolder };

        searchRequest.SetObjectTypesToSearch(objectTypes);

         searchRequest.SetResultsOrderBy(PlumtreeField.NAME);

         searchRequest.SetOrderAscending(true);

        searchRequest.SetResultsCount(0, RecordCount);

                     

       

      //Executing the Search

      searchResponse = searchRequest.Execute();

      resultSet = searchResponse.GetResultSet();

       

       

        //iterate through the results

      IEnumerator resultsfolder = resultSet.GetResults();

      while (resultsfolder.MoveNext())

                      {

                          IPortalSearchResult result = (IPortalSearchResult)resultsfolder.Current;

       

      Convert.ToString(result.GetRank() + 1);

      result.GetIconURL().ToString();

      result.GetURL().ToString();

      result.GetName().ToString();

      result.GetExcerpt().ToString();

      result.GetLastModified().ToString();

      result.GetClassID().ToString();

      result.GetObjectID().ToString();

       

      }