asset-share-commons icon indicating copy to clipboard operation
asset-share-commons copied to clipboard

Handling Special Characters in the Asset Share Commons search bar.

Open amanmishra17 opened this issue 3 years ago • 1 comments

Hi Team, We have a free text search requirement in our application, for that we have leveraged the asset share commons search functionality, however we are not able to handle search keyword if it has special character such as '&', '.', '*', etc.

Example if we have a keyword search like 'Awards & Accolades', then in search bar it only takes the first part i.e. Awards and gives result based on that. However we need to consider whole keyword.

Any quick input on this issue is highly appreciated.

amanmishra17 avatar Oct 21 '22 17:10 amanmishra17

Have you tried putting the term in double quotes? .. so:

"awards & accolades"

Else AEM search will search for "awards" and "accolades" .. which should give you pretty similar results actually

davidjgonzalez avatar Oct 21 '22 22:10 davidjgonzalez

@amanmishra17 If you need, you can always do some customization where you can read/manipulate the fulltext search term before it gets processed by the AEM Search engine.

For example, you can implement an OSGi service that implements: https://github.com/adobe/asset-share-commons/blob/develop/core/src/main/java/com/adobe/aem/commons/assetshare/search/providers/QuerySearchPreProcessor.java

and you can do whatever you want to the QueryBuilder query right before its passed to AEM Search engine.

Or, you can make your own fulltext component, and QueryBuilder predicate that does whatever you want.

Ultimately the ASC fulltext search is pretty dumb; it just takes the value entered and passes it to the AEM Search engine. So youll want to have users enter fulltext inputs in the fulltext format AEM expects (unless you want to customize and come up w your own scheme)

davidjgonzalez avatar Oct 24 '22 13:10 davidjgonzalez