hudson.search
Class Search

java.lang.Object
  extended by hudson.search.Search

public class Search
extends Object

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
static class Search.Item
           
static class Search.Result
           
 
Constructor Summary
Search()
           
 
Method Summary
 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)
          Performs a search and returns the match, or null if no match was found or more than one match was found
 SearchResult getSuggestions(org.kohsuke.stapler.StaplerRequest req, String query)
          Gets the list of suggestions that match the given query.
static List<SuggestedItem> suggest(SearchIndex index, String tokenList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

find

public static SuggestedItem find(SearchIndex index,
                                 String query)
Performs a search and returns the match, or null if no match was found or more than one match was found


suggest

public static List<SuggestedItem> suggest(SearchIndex index,
                                          String tokenList)


Copyright © 2004-2013. All Rights Reserved.