cancel
Showing results for 
Search instead for 
Did you mean: 

How to get SearchSessionID?

Former Member
0 Kudos

hi KM-TREX gurus,

I am using the KM IndexManagement API to search for documents indexed by the TREX server.

While doing that I am in need of the "SearchSessionID". Does anybody know where to get it from?

Please help me. It is an urgent need and all your help will be highly appreciated and rewarded.

Thanks a lot in advance.

best regds,

alagammai.

Accepted Solutions (1)

Accepted Solutions (1)

D021954
Advisor
Advisor
0 Kudos

Hi Alagmmi,

SearchSessionId is for SAP use only.

What's your scenario?

Regards Matthias Röbig-Landau

Former Member
0 Kudos

Hi Matthias,

Thanks a lot for your immediate reply.

I am trying to get the search results in a java application using the indices created by KM and maintained by the TREX engine. The aim is to get the search result exactly same as how it is in KM search.

In that, the "HTML Version" link is there. On clicking that link, the file should get displayed in the HTML format. For that I am in need of the SearchSessionID. Is that possible?

Thanks & Best regds,

Alagammai.

Message was edited by: Alagammai Arunachalam

Former Member
0 Kudos

Hi Alagammai,

com.sapportals.wcm.rendering.property.cm.PropertyRendererHighlightedContentLink might help further:


private Component renderHighlightedContentLink(String propertyValue, IResource resource){
String values[] = StrUtil.decodeStrings(propertyValue);
int i = 0;
String searchSessionMode = null;
String searchSessionID = null;
String docUri = null;
String docIndex = null;
searchSessionMode = values<i>;
searchSessionID = values[++i];
docUri = values[++i];
docIndex = values[++i];
//.....
link.setReference(createHighlightedContentLinkUrl(searchSessionMode, searchSessionID, docUri, docIndex));
}

regards,

dimitry

D021954
Advisor
Advisor
0 Kudos

Hi Alagammi,

obviously Dimitry has a 'Decoder'.

But as I said SearchSessionID is not for public and I'm not sure if you can access the SAP search session at all in your scenario.

You can not be sure that SAP change this behaviour.

In case you KM indexmanagement interface the relevant coding to get the 'HTML Version' is:

IExtendedSearchIndex index =

(IExtendedSearchIndex)indexService.getIndexForResource(resource, IWcmIndexConst.SERVICE_TYPE_SEARCH);

Collection collection = index.getHighlightedContent(resource,queryList);

java.util.Iterator it = collection.iterator();

while (it.hasNext()) {

tmResult = (ITextminingResult)it.next();

}

if ((tmResult.getResult() != null) && (tmResult.getResult().length() > 0)) {

HTMLFragment html = new HTMLFragment(tmResult.getResult());

}

Alternatively you can use the 'html_command', in case you use commands.

Regards Matthias Röbig-Landau

Former Member
0 Kudos

hi Matthias,

I used the below code snippet to display the file in html format. Can you tell me whether this kind of coding will affect when we do an upgrade?

uriRef = ug.getResourcePageUri (PathKey.HIGHLIGHTED_CONTENT_PAGE, rid, null);

strUriRef1 = uriRef.getPath().substring(uriRef.getPath().indexOf("/documents"));

strBuffUriRef = new StringBuffer(uriRef.getPath().substring(0,uriRef.getPath().indexOf(strUriRef1)));

strBuffUriRef.append("?DocumentUri=");

strBuffUriRef.append(strUriRef1);

b.append("

<a href=""strBuffUriRef.toString()"" target="_blank">");

b.append("HTML Version");

b.append("</a> </td>");

best regds,

alagammai.

Former Member
0 Kudos

hi Dimitry,

Can you tell me how to get the "propertyValue" you have provided as argument to the "renderHighlightedContentLink()" method?

best regds,

alagammai.

Former Member
0 Kudos

hi Matthias,

I tried the code snippet provided by you too. But I donno how to use that htmlfragment created by using the code snippet provided by you to open the target file in html format in a new window.

Can you provide insight into this issue?

best regds,

alagammai.

D021954
Advisor
Advisor
0 Kudos

Hi Alagammi,

in the example tmResult is pure HTML.

The HTMLfragment is a released HTMLB UI element (package com.sapportals.htmlb.*).

By the way: Did you manage to place the 'Details' link.

Because there rather similar exists an UIHTMLVersionCommand that

might be interesting for you.

It even recognizes the SearchSessionID internally.

Regards Matthias Röbig-Landau

Former Member
0 Kudos

hi Matthias,

I am able to place the Details link. HTML Version link everything without using the searchSessionID. But my doubt is whether it will get affected when SAP changes something in its approach or if we make an upgrade.

Did you see my code snippet which i used for HTML Version link? Will that get affected with upgrade?

I have placed 3 replies after your code snippet. Did you read all of them?

Can you please give your comments over them?

Thanks & best regds,

Alagammai.

D021954
Advisor
Advisor
0 Kudos

Hi Alagammi,

sorry, I missed your first reply indeed.

Do you really get 'Highlighted Conent' or only an HTML-Version of the document.

I can't guarantee the stability of this part.

But so far there are no changes done nor planned.

Regards Matthias Röbig-Landau

Former Member
0 Kudos

Hi Matthias,

Thank you for your continued support and guidance.

You are right. I got only the html display of the file. I didn't get the search term highlighted.

Is there any other way in which I can get the highlighted content without using the searchsessionID, as it will not be available outside TREX API.

best regds,

alagammai.

D021954
Advisor
Advisor
0 Kudos

Hi Alagammi,

the recommended way is to use the 'html_version' command.

This supports the searchSessionID internally.

Regards Matthias

Former Member
0 Kudos

hi Matthias,

Can you provide more input regarding this 'html_version' command? Is there any link or document I can look out for more information regarding this?

best regds,

alagammai.

D021954
Advisor
Advisor
0 Kudos

Hi Alagammi,

it's a standard flexUI command.

There is a bunch of articles about flexUI in the SDN.

Regards Matthias

Answers (0)