Package hudson.search

Class 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
    • Field Detail

      • SKIP_PERMISSION_CHECK

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public static boolean SKIP_PERMISSION_CHECK
        Escape hatch for StaplerProxy-based access control
    • Constructor Detail

      • Search

        public Search()
    • 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()
      • getTarget

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public Object getTarget()
        Specified by:
        getTarget in interface org.kohsuke.stapler.StaplerProxy