Hi.I want to search for content with a specific categorie. This method gives me the reference of the first result for a Query:
private static Reference FindInAlfresco(String search) {
Reference ref = new Reference();
final Store STORE = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
if (suche == "") return null;
try
{
AuthenticationUtils.startSession("admin", "admin");
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
Query query = new Query(Constants.QUERY_LANG_LUCENE, search);
// Execute the query
QueryResult queryResult = repositoryService.query(STORE, query, false);
// Display the results
ResultSet resultSet = queryResult.getResultSet();
ResultSetRow[] rows = resultSet.getRows();
if (rows == null)
{
System.out.println("No query results found.");
ref = null;
}
else
{
System.out.println("Results from query:");
outputResultSet(rows);
ref.setStore(STORE);
ref.setUuid(rows[0].getNode().getId());
ResultSetRow row = rows[0];
NamedValue[] columns = row.getColumns();
System.out.println("");
System.out.println("Ausgelesen:");
String pfad = row.getColumns(columns.length-1).getValue();
System.out.println(pfad);
ref.setPath(pfad);
}
}
catch(Throwable e)
{
e.printStackTrace();
}
finally
{
AuthenticationUtils.endSession();
}
return ref;
}
How does the search-string have to look like to resolve a content-reference with a specific categorie? Or what in this method I have to change? Has anyone a code sample searching for content like I want to do?Thx.