Search Form Integration Method
By placing a search form on existing sites, you can direct users to Fess search results. This example explains placing Fess at https://search.n2sm.co.jp/ and adding a search form to each page of an existing site.
Search Form
Place the following code where you want the search form on your page:
To match your site design, add class names with the class attribute and adjust with CSS as needed. Change the https://search.n2sm.co.jp/ URL to the URL of your Fess server.
The search keyword is sent as the q parameter to the Fess search page (/search/). Set maxlength to a value that matches query.max.length (default 1000), which is the maximum keyword length on the Fess side.
Suggest Feature
You can also configure the suggest feature for the search form. To configure, add the following code before </body>:
If your site already uses jQuery, you do not need to add the jQuery script element.
The suggest feature uses the Fess suggest API (/api/v2/suggest-words). Change url to match the URL of your Fess server.
The main options that can be specified for suggestor are as follows.
Specify a value for “z-index” that does not overlap with other elements.
Note
When the search form is placed on a page whose domain differs from the Fess server, the request to the suggest API becomes a cross-origin request. Fess allows all origins by default (api.cors.allow.origin=*), so it works as is. To restrict access, change api.cors.allow.origin in fess_config.properties.
Note
/api/v2/suggest-words is the API provided by Fess itself. The /api/v1/suggest-words endpoint used in earlier versions is no longer provided by Fess core, and the fess-webapp-v1-api plugin must be installed to use it. For new setups, use /api/v2/suggest-words.