/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
*/
package com.sun.portal.search.db;
import com.sun.portal.search.rdm.*;
import com.sun.portal.search.soif.*;
import com.sun.portal.search.util.*;
import com.sun.portal.search.demo.Search;
import java.sql.*;
import javax.naming.*;
import javax.sql.*;
import java.util.*;
/**
*
* Remote RDM Server search result set implementation
*
*/
public class RemoteRDMResultSet extends RDMResultSet {
private List hits;
private Search search;
/**
* Creates a new instance of RemoteRDMResultSet
*/
RemoteRDMResultSet(SToken st, RDMDb database, String query, RDMTransaction t) {
super(st, database, query, t);
}
/**
* Prepare Remote RDM Server search results
*/
void setRemoteRDMSearchResult(Search sch) throws RDMException {
search = sch;
try {
SOIFInputStream sis = search.getResultStream();
hits = new ArrayList();
SOIF soif;
for (soif = sis.readSOIF(); soif != null; soif = sis.readSOIF()) {
hits.add(soif);
}
} catch (Exception e) {
throw new RDMException(e);
}
}
/**
* Retrieve Search Results
* @param i Document index
* @param view Attributes
* @param hltags Highlight tags
* @return a SOIF hit, highlighted and filtered by view
*/
public SOIF getResult(int i, Set view, String[] hltags) {
if (i < hits.size())
return (SOIF)hits.get(i);
else
return null;
}
/**
* Get hit count
* @return total number of hits for this search
*/
public long getHitCount() {
return search.getHitCount();
}
/**
* Get document count
* @return number of docs searched
*/
public long getDocCount() {
return search.getDocumentCount();
}
/**
* Get search result count
* @return current number of hits in this set
*/
public int getResultCount() {
return search.getResultCount();
}
/**
* Transform the result set to string
* @return tring representation of this result set
*/
public java.lang.String toString() {
return super.toString();
}
}
|