3.1.4. Searching for repository content

3.1.4.1. Query usecases
3.1.4.2. XPath queries containing node names starting with a number

Warning

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

Query result processing

// 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();
    }

Scoring

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.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus