cancel
Showing results for 
Search instead for 
Did you mean: 

PARENT Lucene query: how to get child nodes and the parent

sergio
Champ in-the-making
Champ in-the-making
Hi all.

My problems with Lucene query continue.

I would like how exactly the Lucene PARENT query works…..

If I execute the following line of code:

String path = "PARENT:\"" + STORE.getScheme() + "://" + STORE.getAddress() + "/" + "eec7d9d6-8470-11db-85c2-01d4040f47aa" + "\"";
Query query = new Query(Constants.QUERY_LANG_LUCENE, path);

The query works well and retrieves all the child nodes for the parent one indicated by its uuid.

My questions are:
1. Is it possible to modify the PARENT query in order to get by the  ResultSet not only the child nodes but also the parent itself?
2. Is it possible to modify the PARENT query in order to get not only the child nodes of the parent but also all the childs at each deepening level?

All the best,

Sergio
3 REPLIES 3

andy
Champ on-the-rise
Champ on-the-rise
Hi

1) Yes.


(PARENT:"ID"    ID:"ID") -ISCONTAINER:T   

Find the node or its immediate children but not aux data entries.

2) No. Not without using PATH. It is possible to use the partial bridge table information also held in the index but I would not advise this. I would just walk the results.

Regards

Andy

sergio
Champ in-the-making
Champ in-the-making
Many thanks Andy.

I started writing a Java method using recursion to get the first level of nodes and then to get, for each node, recursivly the next child levels.

I will share my code with the the community when it works fine.

All the best,

Sergio

jtorres
Champ in-the-making
Champ in-the-making
Thanks for the info, very usefull ;-).