Hi,
I have an existing query and I have updated it with one filter but now I am getting duplicate results. I don't want duplicate entries.
Query:
SELECT * FROM [nt:base] AS s WHERE (ISDESCENDANTNODE(s, [/etc/commerce/products/myProject/en/devices])) and s.derivedInventoryStatus = 'Back Order' and s.availabilityStatus = 'Sellable'
for unique results, do I need to update any properties for the below nodes ?
1. /oak:index/lucene/indexRules/nt:base/properties/derivedInventoryStatus
2. /oak:index/lucene/indexRules/nt:base/properties/availabilityStatus
Solved! Go to Solution.
Views
Replies
Total Likes
Thanks for your inputs @Abhishekty
We can create Property Index which allows for unique constraint on respective property. In this case, we can create property index for the property named ensembleId.
With this in place, it won't let you copy the node at first place/to have a node with duplicate ensembleId (Unique constraint violation exception would be thrown)
OOTB property index definition with unique constraint support -
You can refer the same and create one for ensembleId (declaringNodeTypes - nt:unstructured, propertyNames - ensembleId)
Unfortunately, there are no aggregation functions in JCR SQL|XPath|JCR-SQL2. The only thing I can suggest you, is to iterate over these nodes and do all calculations or put path in SET in your code
Hi @Abhishekty
Could you please let know
@Vijayalakshmi_S , Thanks for reply.
Please my inline comments :
Thanks for your inputs @Abhishekty
We can create Property Index which allows for unique constraint on respective property. In this case, we can create property index for the property named ensembleId.
With this in place, it won't let you copy the node at first place/to have a node with duplicate ensembleId (Unique constraint violation exception would be thrown)
OOTB property index definition with unique constraint support -
You can refer the same and create one for ensembleId (declaringNodeTypes - nt:unstructured, propertyNames - ensembleId)
Views
Likes
Replies