06-17-2015 07:47 AM
I have created the following document types: Bc,Bl,facture; they are all linked by the field num_bc. I created a local search by num_bc, my issue is that the search can results only one of the three document types but not all of them.
here's what I've tried:
<coreQueryPageProvider>
<property name="coreSession">#{documentManager}</property>
<property name="maxResults">DEFAULT_NAVIGATION_RESULTS</property>
<whereClause docType="liasse_search">
<predicate parameter="bc:num_bc" operator="=">
<field schema="liasse_search" name="num_bc" />
</predicate>
<predicate parameter="bl:num_bc" operator="=">
<field schema="liasse_search" name="num_bc" />
</predicate>
<predicate parameter="fctr:num_bc" operator="=">
<field schema="liasse_search" name="num_bc" />
</predicate>
<fixedPart>
ecm:isCheckedInVersion = 0 AND
ecm:mixinType != 'HiddenInNavigation' AND
ecm:currentLifeCycleState != 'deleted' AND
ecm:primaryType = 'bc' OR ecm:primaryType = 'bl' OR ecm:primaryType = 'facture'
</fixedPart>
<sort column="dc:title" ascending="true" />
<pageSize>20</pageSize>
</whereClause>
</coreQueryPageProvider>
07-23-2015 11:57 AM
Hi Dalal, the 3 document types must have those fields in common in the same schema and when you execute this query, it SUMS the three fields like an "AND" instead an "OR". I did something like this in my project. This is the coreQuery:
<whereClause docType="liasse_search">
<fixedPart>
ecm:primaryType IN ('b1',
'facture',
'bc')
AND ecm:mixinType !=
'HiddenInNavigation'
AND NOT (ecm:mixinType = 'Collection' AND
ecm:name = 'Locally
Edited')
AND ecm:isCheckedInVersion = 0
AND
ecm:currentLifeCycleState != 'deleted'
AND SORTED_COLUMN IS NOT
NULL
</fixedPart>
You also have to create a schema with with num_bc (num_schema in the following code), add this schema to your three types, and create in this schema the field "num_bc"
<doctype name="facture" extends="Document">
<schema name="num_schema" />
<schema name="facture_schema" />
</doctype>
<doctype name="b1" extends="Document">
<schema name="num_schema" />
<schema name="b1_schema" />
</doctype>
<doctype name="b2" extends="Document">
<schema name="num_schema" />
<schema name="b2_schema" />
</doctype>
You also can do it with hierachy with a supertype
For example
<doctype name="myCustomSuperType" extends="Document">
<schema name="myCustomSuperType_schema" />
</doctype>
<doctype name="facture" extends="myCustomSuperType">
<schema name="facture_schema" />
</doctype>
<doctype name="b1" extends="myCustomSuperType">
<schema name="b1_schema" />
</doctype>
I hope this helps you.
EDIT: This solution should also work for you without creating a new schema (using parameters instead of predicates)
<fixedPart>
ecm:isCheckedInVersion = 0 AND
ecm:currentLifeCycleState != 'deleted' AND
( ecm:primaryType = 'bc' OR ecm:primaryType = 'bl' OR ecm:primaryType = 'facture' ) AND
( bc:num_bc = ? OR
b1:num_bc = ? OR fctr:num_bc = ?) )
</fixedPart>
</whereClause>
<parameter>#{searchDocument.liasse_search.num_bc}</parameter>
<parameter>#{searchDocument.liasse_search.num_bc}</parameter>
<parameter>#{searchDocument.liasse_search.num_bc}</parameter>
07-23-2015 11:57 AM
Hi Dalal, the 3 document types must have those fields in common in the same schema and when you execute this query, it SUMS the three fields like an "AND" instead an "OR". I did something like this in my project. This is the coreQuery:
<whereClause docType="liasse_search">
<fixedPart>
ecm:primaryType IN ('b1',
'facture',
'bc')
AND ecm:mixinType !=
'HiddenInNavigation'
AND NOT (ecm:mixinType = 'Collection' AND
ecm:name = 'Locally
Edited')
AND ecm:isCheckedInVersion = 0
AND
ecm:currentLifeCycleState != 'deleted'
AND SORTED_COLUMN IS NOT
NULL
</fixedPart>
You also have to create a schema with with num_bc (num_schema in the following code), add this schema to your three types, and create in this schema the field "num_bc"
<doctype name="facture" extends="Document">
<schema name="num_schema" />
<schema name="facture_schema" />
</doctype>
<doctype name="b1" extends="Document">
<schema name="num_schema" />
<schema name="b1_schema" />
</doctype>
<doctype name="b2" extends="Document">
<schema name="num_schema" />
<schema name="b2_schema" />
</doctype>
You also can do it with hierachy with a supertype
For example
<doctype name="myCustomSuperType" extends="Document">
<schema name="myCustomSuperType_schema" />
</doctype>
<doctype name="facture" extends="myCustomSuperType">
<schema name="facture_schema" />
</doctype>
<doctype name="b1" extends="myCustomSuperType">
<schema name="b1_schema" />
</doctype>
I hope this helps you.
EDIT: This solution should also work for you without creating a new schema (using parameters instead of predicates)
<fixedPart>
ecm:isCheckedInVersion = 0 AND
ecm:currentLifeCycleState != 'deleted' AND
( ecm:primaryType = 'bc' OR ecm:primaryType = 'bl' OR ecm:primaryType = 'facture' ) AND
( bc:num_bc = ? OR
b1:num_bc = ? OR fctr:num_bc = ?) )
</fixedPart>
</whereClause>
<parameter>#{searchDocument.liasse_search.num_bc}</parameter>
<parameter>#{searchDocument.liasse_search.num_bc}</parameter>
<parameter>#{searchDocument.liasse_search.num_bc}</parameter>
Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.