I am using Apache Jackrabbit as a database.
In my case, root node has numbers of child nodes(only at depth 1). All child node has unique name, ie, some Integer. Each child Node have some properties that I have used further.
My task
I need to take the top 10 nodes whose keys (integer values) are minimal.
My thinking
To achieve the above goal, I make a request that sorts the keys of all the child nodes and selects the top 10. Then, using these keys, I get all the corresponding nodes, and after work I delete all the key / value pairs.
To do this, I searched a lot on the Internet how to run a query. Could you tell me how to run a request on apache jackrabit. Well, if you explain with an example.
Change No. 1
public class JackRabbit {
public static void main(String[] args) throws Exception { try { Repository repository = JcrUtils.getRepository("http://localhost:4502/crx/server"); javax.jcr.Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray())); Node root = session.getRootNode();
}
Exception
javax.jcr.query.InvalidQueryException: Query: select * from nt:(*)base where name= '12345'; expected: <end> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:69) at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:51) at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:45) at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.executeQuery(RepositoryServiceImpl.java:2004) at org.apache.jackrabbit.jcr2spi.WorkspaceManager.executeQuery(WorkspaceManager.java:349) at org.apache.jackrabbit.jcr2spi.query.QueryImpl.execute(QueryImpl.java:149) at jackrabbit.JackRabbit.main(JackRabbit.java:36)
I want to write a request below scenereo

Here, nodes of integer value have some properties. I want to sort these nodes by their integer values ββand extract the top 50 nodes for further processing.
Help me with this.
source share