adobe / asset-share-commons

A modern, open-source asset share reference implementation built on Adobe Experience Manager (AEM)
https://opensource.adobe.com/asset-share-commons/
Apache License 2.0
88 stars 107 forks source link

Dynamic Filter based on the result sets of assets. #300

Closed bnayneupane closed 5 years ago

bnayneupane commented 6 years ago

Hi Folks,

Question/Clarifications: 1. Wondering if there is any guidance/documentations if i can make the filters dynamic based on the result set of the assets?

Note/Current View: I am referring to asset-share-commons 1.5.2 version. To the best of my knowledge; The current filters are static and the filter values are fetched from static data source. If any filter is applied, then it is making query and updating the result page.

Looking forward for any viewpoints.

Regards, Bnay

davidjgonzalez commented 6 years ago

Are you asking about dynamic facets, or just generally writing custom (server side) code that changes filter options based on the current search and it’s result sets?

Dynamic facets are not recommended due to performance concerns w how querybuilder api handles then today, but the latter can definitely be done.

If you can provide so more details into exactly what you’re trying to do we can provide some more color.

Thanks!

bnayneupane commented 6 years ago

Hi David Below is the one which we have tried.

Tried Solution: We are not able to extract facets with asset-share. We have added custom predicate evaluator to extract the facets and facet count(Something Similar to https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/adobe/acs/samples/search/querybuilder/impl/SampleFacetPredicateEvaluator.java).

Now, We are struck at the updating the new facet filters along with existing static filters. The problem is, The facets, which are returning are having different predicates than asset-share predicates.

We have tried add Facet extraction code to PropertyValuesPredicateEvaluator(https://github.com/Adobe-Marketing-Cloud/asset-share-commons/blob/develop/core/src/main/java/com/adobe/aem/commons/assetshare/search/impl/predicateevaluators/PropertyValuesPredicateEvaluator.java ) by overriding getFacetExtractor (). But it is still not able to extract the facets.

Appreciate if you can help please. Regards Bnay

davidjgonzalez commented 6 years ago

First off, Facet extraction in QueryBuilder + Oak is known to be slow on large result sets - so if you are doing this dynamic faceting, you must ensure that eligible queries run against real, representative data sets, have acceptable query times. Several ppl have implemented this on top of Asset share commons and the query times can take several minutes when the result sets are large.

That said, Im not sure i follow 100% .. what exactly isn't matching up? The only thing i could see not matching are the QB predicate groups. Could you give a concrete example?

bnayneupane commented 6 years ago

Hi David

First off, Facet extraction in QueryBuilder + Oak is known to be slow on large result sets - so if you are doing this dynamic faceting, you must ensure that eligible queries run against real, representative data sets, have acceptable query times. Several ppl have implemented this on top of Asset share commons and the query times can take several minutes when the result sets are large.

Current Analysis: We are heading to the same direction – my concern is impact/issue related to Performance; Where we are: Execute a Query/QueryBuilder for Facet extraction; then extract and render it in Asset Share search result page via the result set object.

That said, I’m not sure I follow 100% ... what exactly isn't matching up? The only thing i could see not matching are the QB predicate groups. Could you give a concrete example?

The current asset-share-commons uses custom predicate evaluator [https://github.com/Adobe-Marketing-Cloud/asset-share-commons/blob/develop/core/src/main/java/com/adobe/aem/commons/assetshare/search/impl/predicateevaluators/PropertyValuesPredicateEvaluator.java] for "propertyvalues”.

The Snapshot of code we have followed from GitHub @ [https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/adobe/acs/samples/search/querybuilder/impl/SampleFacetPredicateEvaluator.java] , to extract the facets. The facet result predicates (which are coming from faceted result), doesn’t match with the existing predicates(propertyvalues). As result, we are not receiving the expected results. Is it possible to integrate both predicate evaluators?

Request: 1/ Are there any alternative ways / Custom Implementation of doing this without impacting the performance as the requirement is to make almost all the fields in the Asset Share page as dynamic as practically possible?

In advance many thanks for your support.

Regards Bnay

davidjgonzalez commented 6 years ago

@bnayneupane ah - i see; propertyvalues is basically a "wrapper" for the OOTB predicate evaluator... ill have to play around with this to see what it does (TBH, i dont recall exactly how the facets are broken out off the top of my head). That being said, this will likely be a lower priority since we dont really support nor encourage facet extraction today due to the performance implications.

Im not aware of any ways to efficiently simulate facet extraction - the problem is simply every result must be checked, so the cost is O(N) where N is the # of results.

Anything that relies on the inspection of every result has the potential to be (very) slow.

vineeth522 commented 5 years ago

@davidjgonzalez In AEM 6.5, QueryBuilder was extended to provide results with dynamic facets . Will it be implemented in asset share commons?