Hi,
I added search results component , I configured the Property filter in operation field I choosen DOES NOT EQUALS I saved it and closed the property filter. Then after in property filter I selected Images,presentation,document, I have to get non image, non presentation, non document files as result but in search result I am getting images, presentation, document files as well as with video files.
Can anyone help me on this issue.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Vani1012,
This is correct behavior. Referring to official documentation, you can see that Property filter use OR for multiple values:
Comma delimited values are evaluated as OR’s.
Above can be easily confirmed checking implementation:
Now, if you have a look how predicate is evaluated into query you will get below values:
Query string:
http://localhost:4502/editor.html/content/asset-share-commons/en/light.html?1_group.propertyvalues.property=.%2Fjcr%3Acontent%2Fmetadata%2Fdc%3Aformat&1_group.propertyvalues.operation=unequals&1_group.propertyvalues.0_values=image%2Fjpeg%2Cimage%2Fgif%2Cimage%2Fpng%2Cimage%2Ftiff%2Cimage%2Fvnd.adobe.photoshop%2Capplication%2Fpostscript&1_group.propertyvalues.1_values=application%2Fvnd.openxmlformats-officedocument.wordprocessingml.document%2Capplication%2Fpdf%2Ctext%2Fplain&1_group.propertyvalues.3_values=application%2Fvnd.openxmlformats-officedocument.presentationml.presentation&orderby=%40jcr%3Acontent%2Fjcr%3AlastModified&orderby.sort=desc&layout=card&p.offset=0&p.limit=24
This evaluates to following predicate tree:
ROOT=group: limit=24, guessTotal=100, offset=0[ {orderby=orderby: orderby=@jcr:content/jcr:lastModified, sort=desc} {type=type: type=dam:Asset} {2_group=group: or=true[ {0_path=path: path=/content/dam/asset-share-commons/en/public} {1_path=path: path=/content/dam/we-retail/en} ]} {4_group=group: [ {mainasset=mainasset: mainasset=true} ]} {5_group=group: [ {property=property: property=jcr:content/contentFragment, operation=not} ]} {8_group=group: [ {1_propertyvalues=propertyvalues: property=./jcr:content/metadata/dc:format, operation=unequals, 0_values=image/jpeg,image/gif,image/png,image/tiff,image/vnd.adobe.photoshop,application/postscript, 1_values=application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/plain, 3_values=application/vnd.openxmlformats-officedocument.presentationml.presentation} ]} ]
Finally you will get xPath like this:
(/jcr:root/content/dam/asset-share-commons/en/public//element(*, dam:Asset)[(not(jcr:content/@contentFragment)) and ((_x002e_/jcr:content/metadata/@dc:format != 'image/tiff' or _x002e_/jcr:content/metadata/@dc:format != 'image/png' or _x002e_/jcr:content/metadata/@dc:format != 'application/vnd.openxmlformats-officedocument.presentationml.presentation' or _x002e_/jcr:content/metadata/@dc:format != 'image/vnd.adobe.photoshop' or _x002e_/jcr:content/metadata/@dc:format != 'text/plain' or _x002e_/jcr:content/metadata/@dc:format != 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' or _x002e_/jcr:content/metadata/@dc:format != 'application/postscript' or _x002e_/jcr:content/metadata/@dc:format != 'image/jpeg' or _x002e_/jcr:content/metadata/@dc:format != 'application/pdf' or _x002e_/jcr:content/metadata/@dc:format != 'image/gif'))] | /jcr:root/content/dam/we-retail/en//element(*, dam:Asset)[(not(jcr:content/@contentFragment)) and ((_x002e_/jcr:content/metadata/@dc:format != 'image/tiff' or _x002e_/jcr:content/metadata/@dc:format != 'image/png' or _x002e_/jcr:content/metadata/@dc:format != 'application/vnd.openxmlformats-officedocument.presentationml.presentation' or _x002e_/jcr:content/metadata/@dc:format != 'image/vnd.adobe.photoshop' or _x002e_/jcr:content/metadata/@dc:format != 'text/plain' or _x002e_/jcr:content/metadata/@dc:format != 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' or _x002e_/jcr:content/metadata/@dc:format != 'application/postscript' or _x002e_/jcr:content/metadata/@dc:format != 'image/jpeg' or _x002e_/jcr:content/metadata/@dc:format != 'application/pdf' or _x002e_/jcr:content/metadata/@dc:format != 'image/gif'))]) order by jcr:content/@jcr:lastModified descending
Analyzing above information you can clearly see how query has been build. What is key, is a fact that OR condition is used instead of AND - this is of course aligned with information from documentation. To achieve your case you will need AND in your condition.
You can do a simple test running SQL2 query from crx, just compere results of below two queries.
SELECT * FROM [dam:Asset] AS s WHERE (s.[jcr:content/metadata/dc:format] <> "image/png" OR s.[jcr:content/metadata/dc:format] <> "image/jpeg")
SELECT * FROM [dam:Asset] AS s WHERE (s.[jcr:content/metadata/dc:format] <> "image/png" AND s.[jcr:content/metadata/dc:format] <> "image/jpeg")
Due to the fact Asset Share Commons does not provide Property filter with AND option, you will need to build your own component and predicate evaluator that will use AND condition. In general you could use exactly the same implementation like the one in Asset Share Commons but changing OR to AND.
Here are some references to Asset Share Commons code:
Can you share url after filter selection , complete configuration e.g option value & metadata property value. Please check assets have the metadata property value set in crxde.
Complete URL:
after I added filter I took one image from searchresult the metadta node is there
Hi @Vani1012,
This is correct behavior. Referring to official documentation, you can see that Property filter use OR for multiple values:
Comma delimited values are evaluated as OR’s.
Above can be easily confirmed checking implementation:
Now, if you have a look how predicate is evaluated into query you will get below values:
Query string:
http://localhost:4502/editor.html/content/asset-share-commons/en/light.html?1_group.propertyvalues.property=.%2Fjcr%3Acontent%2Fmetadata%2Fdc%3Aformat&1_group.propertyvalues.operation=unequals&1_group.propertyvalues.0_values=image%2Fjpeg%2Cimage%2Fgif%2Cimage%2Fpng%2Cimage%2Ftiff%2Cimage%2Fvnd.adobe.photoshop%2Capplication%2Fpostscript&1_group.propertyvalues.1_values=application%2Fvnd.openxmlformats-officedocument.wordprocessingml.document%2Capplication%2Fpdf%2Ctext%2Fplain&1_group.propertyvalues.3_values=application%2Fvnd.openxmlformats-officedocument.presentationml.presentation&orderby=%40jcr%3Acontent%2Fjcr%3AlastModified&orderby.sort=desc&layout=card&p.offset=0&p.limit=24
This evaluates to following predicate tree:
ROOT=group: limit=24, guessTotal=100, offset=0[ {orderby=orderby: orderby=@jcr:content/jcr:lastModified, sort=desc} {type=type: type=dam:Asset} {2_group=group: or=true[ {0_path=path: path=/content/dam/asset-share-commons/en/public} {1_path=path: path=/content/dam/we-retail/en} ]} {4_group=group: [ {mainasset=mainasset: mainasset=true} ]} {5_group=group: [ {property=property: property=jcr:content/contentFragment, operation=not} ]} {8_group=group: [ {1_propertyvalues=propertyvalues: property=./jcr:content/metadata/dc:format, operation=unequals, 0_values=image/jpeg,image/gif,image/png,image/tiff,image/vnd.adobe.photoshop,application/postscript, 1_values=application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,text/plain, 3_values=application/vnd.openxmlformats-officedocument.presentationml.presentation} ]} ]
Finally you will get xPath like this:
(/jcr:root/content/dam/asset-share-commons/en/public//element(*, dam:Asset)[(not(jcr:content/@contentFragment)) and ((_x002e_/jcr:content/metadata/@dc:format != 'image/tiff' or _x002e_/jcr:content/metadata/@dc:format != 'image/png' or _x002e_/jcr:content/metadata/@dc:format != 'application/vnd.openxmlformats-officedocument.presentationml.presentation' or _x002e_/jcr:content/metadata/@dc:format != 'image/vnd.adobe.photoshop' or _x002e_/jcr:content/metadata/@dc:format != 'text/plain' or _x002e_/jcr:content/metadata/@dc:format != 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' or _x002e_/jcr:content/metadata/@dc:format != 'application/postscript' or _x002e_/jcr:content/metadata/@dc:format != 'image/jpeg' or _x002e_/jcr:content/metadata/@dc:format != 'application/pdf' or _x002e_/jcr:content/metadata/@dc:format != 'image/gif'))] | /jcr:root/content/dam/we-retail/en//element(*, dam:Asset)[(not(jcr:content/@contentFragment)) and ((_x002e_/jcr:content/metadata/@dc:format != 'image/tiff' or _x002e_/jcr:content/metadata/@dc:format != 'image/png' or _x002e_/jcr:content/metadata/@dc:format != 'application/vnd.openxmlformats-officedocument.presentationml.presentation' or _x002e_/jcr:content/metadata/@dc:format != 'image/vnd.adobe.photoshop' or _x002e_/jcr:content/metadata/@dc:format != 'text/plain' or _x002e_/jcr:content/metadata/@dc:format != 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' or _x002e_/jcr:content/metadata/@dc:format != 'application/postscript' or _x002e_/jcr:content/metadata/@dc:format != 'image/jpeg' or _x002e_/jcr:content/metadata/@dc:format != 'application/pdf' or _x002e_/jcr:content/metadata/@dc:format != 'image/gif'))]) order by jcr:content/@jcr:lastModified descending
Analyzing above information you can clearly see how query has been build. What is key, is a fact that OR condition is used instead of AND - this is of course aligned with information from documentation. To achieve your case you will need AND in your condition.
You can do a simple test running SQL2 query from crx, just compere results of below two queries.
SELECT * FROM [dam:Asset] AS s WHERE (s.[jcr:content/metadata/dc:format] <> "image/png" OR s.[jcr:content/metadata/dc:format] <> "image/jpeg")
SELECT * FROM [dam:Asset] AS s WHERE (s.[jcr:content/metadata/dc:format] <> "image/png" AND s.[jcr:content/metadata/dc:format] <> "image/jpeg")
Due to the fact Asset Share Commons does not provide Property filter with AND option, you will need to build your own component and predicate evaluator that will use AND condition. In general you could use exactly the same implementation like the one in Asset Share Commons but changing OR to AND.
Here are some references to Asset Share Commons code:
Views
Likes
Replies
Views
Likes
Replies