Search Essentials search-essentials

CAUTION
AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our technical support periods. Find the supported versions here.

Overview overview

The search feature is an essential feature of AEM Communities. In addition to the AEM platform search capabilities, AEM Communities provides the UGC search API for the purpose of searching user generated content (UGC). UGC has unique properties as it is entered and stored separately from other AEM content and user data.

For Communities, the two things generally searched are:

  • Content posted by community members

    • Uses AEM Communities’ UGC search API
  • Users and user groups (user data)

    • Uses the AEM platform search capabilities

This section of the documentation is of interest to developers who are creating custom components that create or manage UGC.

Security and Shadow Nodes security-and-shadow-nodes

For a custom component, it is necessary to use the SocialResourceUtilities methods. The utility methods that create and search for UGC will establish the required shadow nodes and ensure the member has the correct permissions for the request.

What is not managed through the SRP utilities are properties related to moderation.

See SRP and UGC Essentials for information regarding utility methods used to access UGC and ACL shadow nodes.

UGC Search API ugc-search-api

The UGC common store is provided by one of a variety of storage resource providers (SRPs), each possibly having a different native query language. Therefore, regardless of the SRP chosen, custom code should use methods from the UGC API package (com.adobe.cq.social.ugc.api) which will invoke the query language appropriate for the chosen SRP.

ASRP Searches asrp-searches

For ASRP, UGC is stored in the Adobe cloud. While UGC is not visible in CRX, moderation is available from both the author and publish environments. The use of the UGC search API works for ASRP the same as for other SRPs.

Tools do not currently exist for managing ASRP searches.

When creating custom properties that are searchable, it is necessary to adhere to the naming requirements.

MSRP Searches msrp-searches

For MSRP, UGC is stored in MongoDB configured to use Solr for searching. UGC will not be visible in CRX, but moderation is available from both the author and publish environments.

Regarding MSRP and Solr:

  • The embedded Solr for the AEM platform is not used for MSRP
  • If using a remote Solr for the AEM platform, it may be shared with MSRP, but they should use different collections
  • Solr may be configured for standard search or for multilingual search (MLS)
  • For configuration details, see Solr Configuration for MSRP

Custom search features should use the UGC search API.

When creating custom properties that are searchable, it is necessary to adhere to the naming requirements.

JSRP Searches jsrp-searches

For JSRP, UGC is stored in Oak and is visible only in the repository of the AEM author or publish instance on which it was entered.

Since UGC is typically entered in the publish environment, for multi-publisher production systems, it is necessary to configure a publish cluster, not a publish farm, so that the entered content is visible from all publishers.

For JSRP, UGC entered in the publish environment will never be visible in the author environment. Thus all moderation tasks take place in the publish environment.

Custom search features should use the UGC search API.

Oak Indexing oak-indexing

While Oak indices are not automatically created for the AEM platform search, as of AEM 6.2 they have been added for AEM Communities to improve performance and provide support for pagination when presenting UGC search results.

If custom properties are in use and searches are slow, then additional indices would need to be created for the custom properties to make them more performant. To maintain portability, adhere to the naming requirements when creating custom properties that are searchable.

To modify existing indices or create custom indices, refer to Oak Queries and Indexing.

The Oak Index Manager is available from ACS AEM Commons. It provides:

  • A view of existing indices
  • The ability to initiate re-indexing

To view the existing Oak indices in CRXDE Lite, the location is:

  • /oak:index/socialLucene

chlimage_1-235

Indexed Search Properties indexed-search-properties

Default Search Properties default-search-properties

Following are some of the searchable properties used for various Communities features:

Property
Data Type
isFlagged
Boolean
isSpam
Boolean
read
Boolean
influence
Boolean
attachments
Boolean
sentiment
Long
flagged
Boolean
added
Date
modifiedDate
Date
state
String
userIdentifier
String
replies
Long
jcr:title
String
jcr:description
String
sling:resourceType
String
allowThreadedReply
Boolean
isDraft
Boolean
publishDate
Date
publishJobId
String
answered
Boolean
chosenanswered
Boolean
tag
String
cq:Tag
String
author_display_name
String
location_t
String
parentPath
String
parentTitle
String

Naming of Custom Properties naming-of-custom-properties

When adding custom properties, in order for those properties to be visible to sorts and searches created with the UGC search API, it is *required *to add a suffix to the property name.

The suffix is for query languages which use a schema:

  • It identifies the property as searchable
  • It identifies the data type

Solr is an example of a query language which uses a schema.

Suffix
Data Type
_b
Boolean
_dt
Calendar
_d
Double
_tl
Long
_s
String
_t
Text

Notes:

  • Text is a tokenized string, String is not. Use Text for fuzzy (more like this) searches.

  • For multi-valued types, add ‘s’ to the suffix, for example:

    • viewDate_dt: single date property
    • viewDates_dts: list of dates property

Filters filters

Components which include the comment system support the filter parameter addition to their endpoints.

The filter syntax for AND and OR logic is expressed as follows (shown before being URL encoded):

  • To specify OR use one filter param with comma separated values:

    • filter=name eq 'Jennifer',name eq 'Jen'
  • To specify AND use multiple filter params:

    • filter = name eq 'Jackson'&filter=message eq 'testing'

The default implementation of the Search component uses this syntax as can be seen in the URL that opens the Search Results page in the Community Components guide. To experiment, browse to http://localhost:4503/content/community-components/en/search.html.

Filter operators are:

EQ
equals
NE
not equals
LT
less than
LTE
less than or equal to
GE
greater than
GTE
greater than or equal to
LIKE
fuzzy match

It is important that the URL references the Communities component (resource) and not the page on which the component is placed:

  • Correct: forum component
    • /content/community-components/en/forum/jcr:content/content/forum.social.json
  • Incorrect: forum page
    • /content/community-components/en/forum.social.json

SRP Tools srp-tools

There is an Adobe Marketing Cloud GitHub project which contains:

AEM Communities SRP Tools

This repository contains tools for managing data in SRP.

Currently, there is one servlet that provides the ability to delete all UGC from any SRP.

For example, to delete all UGC in ASRP:

curl -X POST http://localhost:4502/services/social/srp/cleanup?path=/content/usergenerated/asi/cloud -uadmin:admin

Troubleshooting troubleshooting

Solr Query solr-query

To help troubleshoot problems with a Solr query, enable DEBUG logging for

com.adobe.cq.social.srp.impl.SocialSolrConnector.

The actual Solr query will be displayed URL encoded in the debug log:

Query to solr is: sort=timestamp+desc&bl=en&pl=en&start=0&rows=10 &q=%2Btitle_t:(hello)+%2Bprovider_id:\/content/usergenerated/asi/mongo/content/+%2Bresource_type_s:&df=provider_id&trf=verbatim&fq={!cost%3D100}report_suite:mongo

The value of the q parameter is the query. Once the URL encoding is decoded, the query can be passed to the Solr Admin Query tool for further debugging.

recommendation-more-help
5d37d7b0-a330-461b-814d-068612705ff6