Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Adding custom predicate

Avatar

Former Community Member

In the attached picture, how can I add in my own custom predicate. That is the edition search form page btw.

My use case is I'm trying to search for a property but need a 'LIKE' constraint in there. The

OOTB property predicate currently doesn't do that.

 

Thanks you

19 Replies

Avatar

Level 10

Because ootb one does not do that -- you can write your own using Java - this API: com.day.cq.search.PredicateGroup.

See this article as an example: 

https://helpx.adobe.com/experience-manager/using/customtags1.html

Hope this helps....  

Avatar

Former Community Member

Sorry if I wasn't clear. I want to add my own custom predicate into that list. So I can tie my custom component in with my own query.

So when I edit a search form I want to be able to see my custom predicate in that list and add that into the form.

Avatar

Level 10

I have never attempted to configure the search form. However - here is the docs: 

https://docs.adobe.com/docs/en/aem/6-1/administer/operations/search-forms.html

Looks like you can configure a lot there. Look at the section title: ADDING OPTIONS PREDICATES. Looks like you can overlay some nodes to meet your requirements. Have you tried that? 

Avatar

Former Community Member

I looked into that however it will still function the same as putting in an property predicate. I need to change up how the property predicate queries in the back end

and looking ways to extend this.

Avatar

Level 10

The best way to achieve your backend (predicate queries in the back end) is to write your custom back end using Java API (ie -https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/Predic...)  and then hook into that from an overlay. Without writing your own logic - you are limited to what the OOTB ones do - as you stated they do not do what you need them to do. 

Avatar

Former Community Member

Is there a way I can hook this on to a the OOTB Assets Admin Search Rail?

Maybe add a component in the search rail that can link to the back end when selected?

Avatar

Level 10

With AEM - you can add new views - see this article where Lokesh (2nd on leader board and 2015 community member of the year) wrote a custom view and hooked into AEM from the TOOLS menu. This is a Vanity URL tool - but it shows you how to add custom views. So in your case - you can call logic to use your custom Predicate and call it similiar to how Lokesh called his tool. 

http://scottsdigitalcommunity.blogspot.ca/2016/02/developing-vanitypath-manager-for-adobe.html

Avatar

Employee

See: https://shreshthkumar.wordpress.com/ Should help has a steps by step process of what you are trying to do. 

Avatar

Former Community Member

I've managed to add in the custom predicate into the search form field.

My only problem is hooking the bank end logic to my custom predicate.

According to this adobe code:
https://github.com/Adobe-Marketing-Cloud/aem-docs-custom-predicate-evaluator/blob/master/src/main/ja...

Not sure where in CRDXE can I hook this line from the code onto : @Component(metatype = false, factory = "com.day.cq.search.eval.PredicateEvaluator/repli")

 

Thanks

Avatar

Former Community Member

Kanika Gera wrote...

See here: https://docs.adobe.com/docs/en/cq/5-6-1/developing/implementing-custom-predicate-evaluator.html for the details on your version of AEM 

 


Sorry but this doesn't quite answer my last post, it's the same code but just on GitHub. I need to know how to hook this on to the front end/crxde

Avatar

Level 2

Hi Big Red,

any success on this issue ?

If yes please share the solution

Avatar

Level 10

What issue are you having? How to use custom predicate?

Avatar

Level 2

Hi,

Did u succeed in creating new custom search predicate?

If yes ,pls share the steps to follow

Thanks,

Ashwini

Avatar

Level 7

For adding a custom asset search predicate, you need to create 3 things:-

  • overlay and add your field -  /libs/settings/dam/search/facets/formbuilderconfig/predicatetypes/items/<fulltext>
  • Create a field property resource - dam/gui/coral/components/admin/customsearch/formbuilder/predicatefields/fulltextpredicatefield
  • Create field resource type - dam/gui/coral/components/admin/customsearch/searchpredicates/fulltextpredicate
  • Select a field resource view(How it should look) - granite/ui/components/foundation/form/textfield

Your back end logic will hook into Step 2 and 3.

Avatar

Level 2

Hi,

Did you succeed in this?

Pls can you share the steps.

Thanks,

Venkat

Avatar

Level 2

I created custom asset search predicate and able to see under Assets Admin Search Rail

1749760_pastedImage_0.png

Now i want to know how i can connect this custom asset search predicate to my predicate evaluator in the backend.

Thanks,

Venkat