This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/search.js

26 lines
550 B
JavaScript

/**
This component helps with Searching
@class Search
@namespace Discourse
@module Discourse
**/
Discourse.Search = {
/**
Search for a term, with an optional filter.
@method forTerm
@param {String} term The term to search for
@param {String} typeFilter An optional filter to restrict the search by type
@return {Promise} a promise that resolves the search results
**/
forTerm: function(term, typeFilter) {
return Discourse.ajax('/search', {
data: { term: term, type_filter: typeFilter }
});
}
}