Package hudson.search
Class Search
- java.lang.Object
-
- hudson.search.Search
-
- All Implemented Interfaces:
org.kohsuke.stapler.StaplerProxy
public class Search extends Object implements org.kohsuke.stapler.StaplerProxy
Web-bound object that provides search/navigation capability.This object is bound to "./search" of a model object via
SearchableModelObject
and serves HTTP requests coming from JavaScript to provide search result and auto-completion.- Author:
- Kohsuke Kawaguchi
- See Also:
SearchableModelObject
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Search.Item
static class
Search.Result
-
Field Summary
Fields Modifier and Type Field Description static boolean
SKIP_PERMISSION_CHECK
Escape hatch for StaplerProxy-based access control
-
Constructor Summary
Constructors Constructor Description Search()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
doIndex(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
void
doSuggest(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, String query)
Used by search box auto-completion.void
doSuggestOpenSearch(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, String q)
Used by OpenSearch auto-completion.static SuggestedItem
find(SearchIndex index, String query)
Deprecated.Usefind(SearchIndex, String, SearchableModelObject)
instead.static SuggestedItem
find(SearchIndex index, String query, SearchableModelObject searchContext)
Performs a search and returns the match, or null if no match was found or more than one match was found.int
getMaxSearchSize()
SearchResult
getSuggestions(org.kohsuke.stapler.StaplerRequest req, String query)
Gets the list of suggestions that match the given query.Object
getTarget()
static List<SuggestedItem>
suggest(SearchIndex index, String tokenList)
Deprecated.usesuggest(SearchIndex, String, SearchableModelObject)
instead.static List<SuggestedItem>
suggest(SearchIndex index, String tokenList, SearchableModelObject searchContext)
-
-
-
Method Detail
-
doIndex
public void doIndex(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
- Throws:
IOException
javax.servlet.ServletException
-
doSuggestOpenSearch
public void doSuggestOpenSearch(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter String q) throws IOException, javax.servlet.ServletException
Used by OpenSearch auto-completion. Returns JSON array of the form:["queryString",["comp1","comp2",...]]
See http://developer.mozilla.org/en/docs/Supporting_search_suggestions_in_search_plugins- Throws:
IOException
javax.servlet.ServletException
-
doSuggest
public void doSuggest(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter String query) throws IOException, javax.servlet.ServletException
Used by search box auto-completion. Returns JSON array.- Throws:
IOException
javax.servlet.ServletException
-
getSuggestions
public SearchResult getSuggestions(org.kohsuke.stapler.StaplerRequest req, String query)
Gets the list of suggestions that match the given query.- Returns:
- can be empty but never null. The size of the list is always smaller than a certain threshold to avoid showing too many options.
-
getMaxSearchSize
public int getMaxSearchSize()
-
find
@Deprecated public static SuggestedItem find(SearchIndex index, String query)
Deprecated.Usefind(SearchIndex, String, SearchableModelObject)
instead.
-
find
public static SuggestedItem find(SearchIndex index, String query, SearchableModelObject searchContext)
Performs a search and returns the match, or null if no match was found or more than one match was found.- Since:
- 1.527
-
suggest
@Deprecated public static List<SuggestedItem> suggest(SearchIndex index, String tokenList)
Deprecated.usesuggest(SearchIndex, String, SearchableModelObject)
instead.
-
suggest
public static List<SuggestedItem> suggest(SearchIndex index, String tokenList, SearchableModelObject searchContext)
- Since:
- 1.527
-
getTarget
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Object getTarget()
- Specified by:
getTarget
in interfaceorg.kohsuke.stapler.StaplerProxy
-
-