You are looking at documentation for an older release. Not what you want? See the current release documentation.
eXo Platform supports two query languages - SQL and XPath. A query, whether XPath or SQL, specifies a subset of nodes within a workspace, called the result set. The result set constitutes all the nodes in the workspace that meet the constraints stated in the query.
The Query Lifecycle can be illustrated as follows:
Creating and executing a query
SQL
// get QueryManager
QueryManager queryManager = workspace.getQueryManager();
// make SQL query
Query query = queryManager.createQuery("SELECT * FROM nt:base ", Query.SQL);
// execute query
QueryResult result = query.execute();
XPath
// get QueryManager
QueryManager queryManager = workspace.getQueryManager();
// make XPath query
Query query = queryManager.createQuery("//element(*,nt:base)", Query.XPATH);
// execute query
QueryResult result = query.execute();
// fetch query result
QueryResult result = query.execute();
Now you can get results in an iterator of nodes:
NodeIterator it = result.getNodes();
Or, get the result in a table:
// get column names
String[] columnNames = result.getColumnNames();
// get column rows
RowIterator rowIterator = result.getRows();
while(rowIterator.hasNext()){
// get next row
Row row = rowIterator.nextRow();
// get all values of row
Value[] values = row.getValues();
}
The result returns a score for each row in the result set. The score contains a value that indicates a rating of how well the result node matches the query. A high value means a better matching than a low value. This score can be used for ordering the result.
eXo JCR Scoring is a mapping of Lucene scoring. For more in-depth understanding, see Lucene documentation.
jcr:score
is counted in the next way - (lucene score)*1000f.
Score may be increased for specified nodes, see Indexing boost value.
Also, see an example Ordering by score.