Closed devmondo closed 11 years ago
Not sure I understand the issue. I think what you're getting at is that you want to prevent a search from going through if it matches the previous search? I think you should handle this in your implementation and response functions, not in the visualsearch code.
And in fact DocumentCloud uses multiple facets and merges them into an OR statement. This is definitely something for a server to decide upon.
hi, thanks for reply, what i actually meant is not serverside, what i meant if user search on City facet, i dont want him to again, see City from the drop down Facets List, this will confuse him, hope i am clear on this.
@devmondo - As far as I can tell, this functionality isn't provided by the plugin. However, this effect can be accomplished by querying the searchbox in the plugin's callbacks for the searchbox's current contents and returning only the facets and facet items that haven't already been used. It's a little heavy-handed, but it does work.
For example:
facetMatches: function(callback) {
var facets = $.parseJSON(your_facet_source);
var currentFacets = visualSearch.searchQuery.pluck("category");
facets = facets.filter( function( el ) {
return currentFacets.indexOf( el ) < 0;
});
callback(facets, {
preserveOrder: true
});
}
Hi, awesome work, could we prevent repeating a search on a facet, like right now if user chose to search on country, if he clicks again, the country facet shows up, and this causes incorrect search results.
thanks in advanced.