VS.VERSION = '0.5.0';
VS.VisualSearch = function(options) {
var defaults = {
container : '',
query : '',
autosearch : true,
unquotable : [],
remainder : 'text',
showFacets : true,
readOnly : false,
callbacks : {
search : $.noop,
focus : $.noop,
blur : $.noop,
facetMatches : $.noop,
valueMatches : $.noop,
clearSearch : $.noop,
removedFacet : $.noop
}
};
this.options = _.extend({}, defaults, options);
this.options.callbacks = _.extend({}, defaults.callbacks, options.callbacks);
VS.app.hotkeys.initialize();
this.searchQuery = new VS.model.SearchQuery();
this.searchBox = new VS.ui.SearchBox({
app: this,
showFacets: this.options.showFacets
});
if (options.container) {
var searchBox = this.searchBox.render().el;
$(this.options.container).html(searchBox);
}
this.searchBox.value(this.options.query || '');