Sunday, May 1, 2016

Searching Assets in Contributor UI

In Oracle WebCenter Sites, searching assets in Contributor UI is very easy. Simply login, navigate to Contributor UI, enter search term and click on search will list the assets in list mode.

Whenever WCS is installed, global search is already enabled for indexing all available asset types (global indexes may be disabled on WCS delivery installation). Hence, whatever search term is included in Search, assets are returned from fields which are indexed as global indexing (Check here for list of fields which are indexed for global search). This is Simple Search. For e.g. if you search asset by id, then the asset with exact id match and referenced & associated assets are also returned; which may not useful as you want to search asset of a particular id only. Thus, one has to use Advanced Search; wherein inputing id in the Id column will yield only a particular asset search. Details of using Simple Search and Advanced Search is well explained in User Guide, thus, bragging about it in this blog post is useless.

What I mainly want to focus is that how one can optimize the use of search for not only Contributor UI users but for coding your search web pages too.

Optimizing search for Contributor UI users
Most of you might already know this; but still I think it is better to mention this topic - Saved Search.

Saved Searches are best way to search assets and participate in contribution activities for authors and publishers. In my past projects, I have seen admin/developers not mentioning this simple yet powerful utility to Contributor users which is present out-of-the-box for use. Saved searches can be used for various following purposes:
Creating private list of searched assets with following criteria
  • Assets created/edited user X
  • Tags (If a certain task is to be completed by an user; while creating/editing assets, user can simple add one tag within tags attribute and then search assets by tag and save search for future use)
  • Locale
  • Modified date (Custom Range is very useful in certain scenarios)
  • Asset Type + SubType + Attribute Search (Note: for flex attribute search, asset type and corresponding attribute should be selected for indexing. This is very helpful when assets of particular parent are to be searched)
Creating and sharing list of searched assets: One of best feature of Saved Search is that it can be shared with other users of a particular role which can be very useful in many scenarios.
  • One simple use case is to search assets by locale of a particular asset type. It is very easy to search assets by locale for a particular asset type but it is not very easy for other users who don't use advanced search functionality and thus, it becomes difficult for users to search assets by a particular locale. Thus, sharing this simple locale based saved search can be helpful to other contributors. 
  • Shared vs Unshared assets: Consider a global site containing assets, created with dimension - en_Global(Global English) and other site (Germany) which has assets created with 2 different dimensions: en_DE (English) and de_DE(German). Also, assets of en_Global can be shared to and used by Germany site for associations. Most common ask of customers is how to distinguish which assets are shared assets (meaning global English assets) and which assets are local assets (local English assets of Germany site). Thus, searching assets by both locales (en_Global and en_DE) in Contributor UI, saving them as save search and sharing across all contributor UI users can be very helpful; which can ease the process of contribution activity.
There can be various other scenarios where one can make use of save search functionality.

Moving on, following topics are more useful for developers rather than Contributors and are also very useful when it comes to developing search parts of web pages using: Query assets and Content Query assets.

Query assets can be used for searching assets of only one type but its most powerful usage is that one can include any SQL statement to search assets. For e.g. Search AVIArticle articles whose parentid = [ArticleCategory: Baseball articles asset id] simply including the following query can be useful:
SELECT id from AVIArticle, ArticleCategory_Group where AVIArticle.id=ArticleCategory_Group.childid and ArticleCategory_Group.parentid=1327351718484

Furthermore, more complex queries can used for searching assets; just need to take care that "id" column is return in resultset. Query assets are useful when associated to assets via association but can also be useful in Contributor UI if previewed using a template which can lists down the assets found from Query assets.

Content Query assets are used while creating dynamic recommendation. Dynamic Recommendations can use CSElement to search assets but can also use Content Query assets to search assets. Moreover, Content Query provides more flexibility and freedom to Contributor UI users to decide search criteria whereas when assets are searched using CSElement, developers have to update code to meet the flexible search criteria. For e.g. Consider that a website shows 5 latest news on homepage like a ticker display every week or so; contributor users usually create news asset(s) and publish. Normally, developers develop template such that the template which renders news ticker display will fetch by searching against the latest news based on business search criteria and display news. If now, only 3 latest news of a different criteria is required to be shown, developers need to re-code to fulfill these new flexible requirement if the news assets were searched using either dynamic recommendation (via CSElement) or directly being searched in ticker display template. In such scenario, contributors after creating news asset request developers each time whenever different criteria of news are to be shown. But if dynamic recommendation with Content Query asset is used; it will be very easy for Contributor UI users to just edit the Content Query asset according to their criteria and publish the Content Query asset, thus, no need for interaction with developers and ease the process for all.

Disclaimer: The code and/or the configurations posted are not official recommendations and should be used at sole's discretion with proper testing before deploying on live WebCenter Sites systems. Cheers!!

A simple code compare functionality

One of the most important aspect of any development cycle is deployment and while deployment, it is very important to note the changes don...