cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene -- return nodes that are multi-filed

stevegreenbaum
Champ in-the-making
Champ in-the-making
One of our  requirements is the ability to categorize our documents using several category views of the data. Ideally, the categorization would be dynamic and flexible to allow the sub-categories to be moved under different parents and new category trees to be created. We need to be able to respond to queries such as:  show me documents that are in the category Appeals and also in a particular case folder  (e.g., case #123).  Instead of using Alfresco's built-in categorization feature to support this requirement, we plan to create a folder structure to represent the categories.   So the original appeals document is placed in the case#123 folder, but then is multi-filed into the appeals category folder (i.e., the document will have more than one parent folder). 

Can a single Lucene query be formulated to retrieve the documents that meet this criteria?    Something like this:  TYPE:"cm:content" AND +PATH:"/app:company_home/cm:Cases/cm:serialnumber123//* AND +PATH:"/app:company_home/cm:myCategory1/cm:myCategoryAppeals//*"
3 REPLIES 3

mitpatoliya
Star Collaborator
Star Collaborator
Well I do not think the same node can have more then one parents I mean one document can not reside under more  then on space.
You need to create the another copy in that case.
And also in Query you need to your "OR" rather then "AND" for joining two path queries.

stevegreenbaum
Champ in-the-making
Champ in-the-making
Well I do not think the same node can have more then one parents I mean one document can not reside under more then on space.

Thank you for your input.

Alfresco does support having a node under two folders at the same time.  One of the relationships is considered the "primary", which is where the physical document is located.  The other relationship is essentially a pointer back to the physical document.  This approach was suggested to me by one of the Alfresco engineers for this particular case.  The part that is in question is whether two PATHs can be included in one Lucene statement.

I was originally going to handle this situation using a CMIS query, but then found out that subqueries are not supported.  Conceptually, that approach would have allowed me to find documents that were in the case folder that were also in the category tree.

I'm not stuck on any particular approach to this problem, just looking for a solution that doesn't require the duplicating of documents or metadata from the case#123 folder down to the node.

I know a lot of the Alfresco team are traveling back from DevCon, but I was hoping that someone might see this – hint:  Andy  Smiley Happy

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

You can have as many PATH expression in your lucene query as you like.
I would have to check the spec to see if you can do this in CMIS QL ….(There is no limit in the underlying implementation and you could do it in CONTAINS)

Andy