i need to know if there is anything wrong with this function, the variable "results" is always { } whatever is the searchstring...
Code:
public static void search(String wordName)
{
String searchString="";
searchString="(OTName : '*')";
LAPI_SEARCH search= new LAPI_SEARCH(session);
LLValue brokers= new LLValue();
LLValue broker= new LLValue();
LLValue selectList= new LLValue();
LLValue results= new LLValue();
LLValue result=new LLValue();
int brokerID=0;
int status= search.GetSearchBrokers(brokers);
if (status!=0)
{
}
else
{
for(int i=0; i<brokers.size(); i++)
{
broker=brokers.toValue(i);
//System.out.println(broker.toString());
if ((broker.toString("NodeName")).equals("Enterprise"))
{
brokerID=broker.toInteger("NodeID");
break;
}
}
if (brokerID > 0)
{
selectList.setList();
selectList.setSize(2);
selectList.setString(0,"OTName");
selectList.setString(1,"OTDataID");
if (search.ApplyQuery(brokerID, selectList, searchString, LAPI_SEARCH.SORTBYDEFAULT, "", 0, 100, "LivelinkQueryLanguage", results) !=0)
{
System.out.println("ApplyQuery Failed");
}
else
{
System.out.println("results: " + results.toString()); //always { }
for(int j=0;j<results.size();j++)
{
result=results.toValue(j);
System.out.println(result.toString("OTDataID") + " " + result.toString("OTName"));
}
}
}
}
}