Class RelatedQueriesHandler
java.lang.Object
org.codelibs.fess.api.v2.handlers.RelatedQueriesHandler
Handles
GET /api/v2/related-queries.
Returns related query terms for the given q parameter by delegating to
RelatedQueryHelper.getRelatedQueries(String). When q is blank or
absent the response contains an empty queries array. The response shape
is always a success envelope with status:0:
{ "status": 0, "queries": ["related1", "related2", ...] }
This handler is GET-only; other methods are rejected with
V2ErrorCode.METHOD_NOT_ALLOWED.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) Processes oneGET /api/v2/related-queriesrequest.
-
Constructor Details
-
RelatedQueriesHandler
public RelatedQueriesHandler()Default constructor. The handler is stateless and intended to be instantiated once by the API manager and shared across concurrent requests.
-
-
Method Details
-
handle
public void handle(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException Processes oneGET /api/v2/related-queriesrequest.Reads the
qquery parameter, delegates toRelatedQueryHelper.getRelatedQueries(String), and writes the result as a success envelope. An empty or absentqyields an emptyqueriesarray rather than an error.- Parameters:
req- the incoming HTTP requestres- the HTTP response to write to- Throws:
IOException- if writing the envelope fails
-