Searching assets is very basic functionality required in various online sites whether be a content search, tagged-content search or even media asset search. Content (Assets) can be any assets like product assets, article assets, etc.
Following instructions are for searching FLEX assets using searchstate tags.
GENERAL STEPS TO FOLLOW:
<searchstate:create name="ss" />
<searchstate:addsimplelikeconstraint name="ss" attribute="cat2" value="Watt%"/>
<assetset:setsearchedassets name="as" constraint="ss" assettypes="Products"/>
<assetset:getattributevalues name="as" attribute="productdesc" listvarname="resultlist"/>
<ics:listloop listname="resultlist">
<ics:listget listname="resultlist" fieldname="value"/><br/>
</ics:listloop>
Apart from using searchstate tags, there are other tags which can be used for searching assets (flex or basic or table data) which are described briefly below:
INFO:
Following instructions are for searching FLEX assets using searchstate tags.
GENERAL STEPS TO FOLLOW:
- For using searchstate tag, add the searchstate taglib at starting of your JSP/XML.
- Create an empty searchstate object (using searchstate:create tag), which can contain 2 operations: "and" & "or".
- Add constraint to the searchstate i.e. adding a condition for restricting search based on single attribute or another searchstate (also called as nested constraint). For adding constraint, use anyone of the following tag as required: searchstate:addlikeconstraint, searchstate:addnestedconstraint, searchstate:addrangeconstraint, searchstate:addsimpleconstraint, searchstate:addsimplestandardconstraint, searchstate:addstandardconstraint, etc. according to you requirement.
- Set the searchstate (Using assetset:setsearchedassets tag)
- Get the required attribute values (Using assetset:getmultiplevalues or assetset:getattributevalues)
- Then list through the result (Using ics:listloop and ics:listget tag)
<searchstate:create name="ss" />
<searchstate:addsimplelikeconstraint name="ss" attribute="cat2" value="Watt%"/>
<assetset:setsearchedassets name="as" constraint="ss" assettypes="Products"/>
<assetset:getattributevalues name="as" attribute="productdesc" listvarname="resultlist"/>
<ics:listloop listname="resultlist">
<ics:listget listname="resultlist" fieldname="value"/><br/>
</ics:listloop>
Apart from using searchstate tags, there are other tags which can be used for searching assets (flex or basic or table data) which are described briefly below:
- ics:sql - It executes inline SQL statement. You can write a SQL query and search against tablename which should be registered SYTEMINFO table.
- ics:callsql - It retrieves and executes a SQL query stored in the SYSTEMSQL table
- ics:sqlexp - This tag is used only to build where clause based on given set of parameters. It does not execute any statement. It passes a column name and an expression that contains the column name to be used as the left side in the where clause.
- ics:selectto - It executes a simple query from a table, which is equivalent to run a simple SQL query like select * from tablename
- asset:search - It locates a list of asset primary table rows based on the asset type and a set of search criteria. Criteria can be defined which can narrow your search. Not recommended for searching FLEX assets.
- asset:list - This tag queries the database and retrieve a list of assets that meets the specified criteria. It creates a list of assets of one type. Specific criteria could be against field/value of certain tablename, passing argument in field name/value pairs, etc. to restrict the list.
INFO:
- The above case is very simple case provided by tag reference itself.
- Check the examples and details of every searchstate tag in TagReference and Developer Guide
- Following is the list which shows which searchstate tags to use for what case:
searchstate:addsimplestandardconstraint - Adds an attribute name/single value constraint to an existing searchstate object.
searchstate:addlikeconstraint - Adds a list of attribute
like
name/value constraints into a new or existing searchstate object.searchstate:
addnestedconstraint
- Nests a searchstate as a constraint within another searchstate.searchstate:
addrangeconstraint - Adds a range constraint to a searchstate on a specific attribute.
searchstate:addsimplelikeconstraint - Adds an attribute
like
name/value constraint into a new or existing searchstate object.searchstate:
addstandardconstraint
- Adds a list of attribute name/value constraints into a new or existing searchstate object.
----------------------------------------------------
SUGGESTIONS/COMMENTS ARE INVITED
----------------------------------------------------
No comments:
Post a Comment