Queries created in Swing
Queries generated from Swing will work like they do inside the search. Please see Search custom filter for reference on how to create and register a filter for the Swing searches.
Queries created in Prime, with filter.
Queries created in Prime can have a filter specified in their System Attributes. An example is the following:
<?xml version="1.0" encoding="utf-8"?>
<props>
<!-- ... -->
<filter>myFilter</filter>
<!-- ... -->
</props>
In Prime, this opens up a specific panel myFilter.html. To have the same functionality in Swing, it is necessary to register the filter with the following namespace
eidosmedia.webclient.extensions.queryFilters.register( filterName, options);
As the following example shows, the configuration is equal to the Swing query filters. Please see Search custom filter for reference on how to create and register a filter for the Swing searches.
The variables specified in the query correspond to the name of the data-xvalue attribute of the input. See example below:
|
An additional defaultValues property can be defined. This means that the filter is executed with those values when the query is launched for the first time. The defaultValues property can also be a function that must returns a JSON object.+ See example at the end of the page. |
|
Operators are ignored in this kind of filter. The filter is used to retrieve a value for all the variables specified with the data-xvalue attribute. |
Query XML
<?xml version="1.0" encoding="UTF-8"?>
<EOMSearch
xmlns="http://EidosMedia.com/EOM/SearchEngine"
xmlns:se="http://EidosMedia.com/EOM/SearchEngine"
xmlns:q="http://EidosMedia.com/EOM/SearchEngine/query"
xmlns:qm="http://EidosMedia.com/EOM/SearchEngine/query/macro"
xmlns:qa="http://EidosMedia.com/EOM/SearchEngine/query/alias"
xmlns:qui="http://EidosMedia.com/EOM/SearchEngine/query/UI"
xmlns:i="http://EidosMedia.com/query/interpolate">
<q:Query type="INDEX">
<q:Properties>
<q:MaxResultItems value="200" />
<q:Index name="@meth01_eomjse1" />
</q:Properties>
<q:Boolean>
<ObjectInfo>
<q:OR>
<type>EOM::Story</type>
<type>EOM::CompoundStory</type>
</q:OR>
</ObjectInfo>
<se:SysAttributes>
<props>
<productInfo>
<q:OR>
<name>
<i:metadata select="production.channel" />
</name>
</q:OR>
</productInfo>
<workfolder>
<i:variable name="production.workfolder.path" />
</workfolder>
</props>
</se:SysAttributes>
</q:Boolean>
<q:Where />
<qui:Query_UI version="1.1" domain="methode">
<qui:selItem list="repositories" />
</qui:Query_UI>
</q:Query>
</EOMSearch>
Filter HTML
<div class="emui-row">
<div class="emui-title">Channel</div>
<div class="emui-content">
<select class="form-control" data-xvalue="production.channel">
<option>Globe-Web</option>
<option>Globe-Print</option>
<option>Globe-Tablet</option>
</select>
</div>
</div>
<div class="emui-row">
<div class="emui-title">Workfolder</div>
<div class="emui-content">
<input type="text" class="form-control" data-xvalue="production.workfolder.path" />
</div>
</div>
Filter Javascript
eidosmedia.webclient.extensions.queryFilters.register('myFilter', {
// template is placed under /config/search/filters
template: 'explorer-filters/swing-filter-explorer-query.html',
defaultValues: {
"production.workfolder.path": "/Globe/Art"
},
/**
* Default values as function
* @param {Object} options - options to be used create default filter values, available properties: currentUser
*
* defaultValues: function(options) {
* return {
* "production.workfolder.path": "/Globe/Art"
* };
* }
*/
/**
* Function called after loading the template, but BEFORE loading the query
* use it to add listeners.
* @param {ContextObject}
* @param {Object} params - the params of the search element
* @param {Node} params.el - the current DOM node analized
*/
onLoad: function( ctx, params ) {
console.log('ON onLoad')
},
/**
* Function called after loading the query
* use it to fix the custom elements.
* @param {ContextObject}
* @param {Object} params - the params of the search element
* @param {Node} params.el - the current DOM node analized
*/
onQueryLoaded: function( ctx, params ) {
console.log('ON QUERY LOADED')
},
/**
* This function must return the value in the form <key>:<value> for each of the
* elements configured.
* @method getSearchValue
* @param {Object} params - the params of the search element
* @param {Node} params.el - the current DOM node analized
* @param {String} params.dataId - the value of the data-xvalue attribute
* @param {Function} getSearchValue() - the method that returns the search value calculated by default.
*/
getSearchValue: function( ctx, params ) {
console.log('GET SEARCH VALUE');
return params.getSearchValue();
}
});