Skip to Content
Former Member
Aug 08, 2007 at 01:16 PM

Problem in retrieving search result


Hi Experts,

I wrote Java Application for Search Using Index Management APIs.

I am not getting any result.

Just look at my code

<b>i have taken some Variable String x="" to test my code</b>

IIndexService indexService =


<b> x=x+ "1"+ indexService.getID();</b>

IFederatedSearch federatedSearch =


// get list of all active indexes

//alternatively use the indexService to get indexes by index ID and add them to a list

List listuser=indexService.getActiveIndexes();

<b>x=x+ " 2 " + listuser.size();</b>

// build IQueryEntryList

SearchQueryListBuilder sqb = new SearchQueryListBuilder();


IQueryEntryList qel = sqb.buildSearchQueryList();

<b> x=x+ " 3 " + qel.size();</b>


ISearchSession session = federatedSearch.searchWithSession(qel, listuser,resourseContext);

<b> x= x + " 4 " + session.getTotalNumberResultKeys();</b>

//get the Results

ISearchResultList results = session.getSearchResults(1,session.getTotalNumberResultKeys());

ISearchResultListIterator iter = results.listIterator();

<b> x= x " 5 " results.size();</b>

while (iter.hasNext())


ISearchResult result =;

IResource resource = result.getResource();

IURLGeneratorService url =

(IURLGeneratorService)ResourceFactory.getInstance ().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);

uri=uri + url.getResourcePageUri(PathKey.CONTENT_ACCESS_PATH,resource.getAccessRID(),null).toString();

<b> x=x+" 6 ";</b>


<b> x=x+ " 7 "+uri.length();</b>}


return x;


The output what i am getting is....

For this line <b> session.getTotalNumberResultKeys(); </b> i am getting output as 1 (one).

Means there is one result.

I am retrieving the results and storing it in 'results' list object

like this

ISearchResultList results = session.getSearchResults(1,session.getTotalNumberResultKeys());

When i say results.size() i am getting 0 as output.

What is this strange behaviour....?

Total results are 1(one)

When i try to retrieve them it says 0(zero) results.

When i perform normal search in protal there also i am getting only one result(when i search * as a search query).

the same i am doing it here.But i am not able to retrieve the result.

To test this application , i am converting this java Class into Webservice and deploying it in searver.

The reason why i am converting it into webservice is , it will be used other portal i.e Sharepoint Portal.(They will call this webservice in their code)

Why is it happening so.

Any one has ideas , where it is going wrong.