There is a possibility to implement a simple full text search functionality using Gentics Portal | java and Gentics Mesh Search Plugin. Using a dedicated search handler configuration one can enable the handler itself (disabled by default), provide a Handlebars template for the results rendering, as well as perform some basic search request configuration.
Query parameters
By default the search handler expects a template named searchresults.hbs, serving at /search endpoint, accepting the following parameters:
-
qcontains the actual query text for a full text search -
pcontains the current page index -
tcontains the comma separated list of tags to look upon (if the content is tagged) -
lcontains the target content language in ISO 639-1 code
Results
An example of Handlebars template for results visualizing:
{{#if gpj_search_results.totalHits }}
<h2>{{ gpj_search_results.totalHits }} result{{#if equals gpj_search_results.totalHits 1}}{{else}}s{{/if}}</h2>
<ul>{{#each gpj_search_results.results}}
<li><a href="{{ raw.fields.gtx_url }}">{{ raw.fields.name }}</a></li>
{{/each}}</ul>
{{else}}
<h2>No results</h2>
{{/if}}
Where the variables are:
-
gpj_request_querycontains an object of request query parameters and values -
gpj_search_curActioncontains a string with request endpoint and action -
gpj_search_resultscontains an object with search results.
See Gentics Mesh Search Plugin documentation for details.
