This plugin enables to index objects fr.paris.lutece.plugins.grubusiness.business.customer.Customer of the library gru-library-grubusiness. A search on customers can be then performed.
This plugin contains two indexing implementations:
Indexing
The class managing the indexing is fr.paris.lutece.plugins.gruindexing.business.lucene.LuceneCustomerDAO. It is also configured as a bean in the Spring context. It can be configured:
Search
The class managing the search is fr.paris.lutece.plugins.gruindexing.business.lucene.LuceneCustomerDAO. See the above section Indexing to configure the class.
Only the first name and/or the last name can be searched.
Autocomplete search
The class managing the autocomplete search is fr.paris.lutece.plugins.gruindexing.web.rs.lucene.LuceneAutoCompleteRestService. It is also configured as a bean in the Spring context. It is a web service which can be called at the URL /rest/lucene/autocomplete with a GET method. The parameter query must contain the term(s) to search.
Only the first name and/or the last name can be searched.
The autocomplete search returns a JSON string with the following fields:
{ "autocomplete": [{ "output": "John Doe", "search":{ "first_name":"John", "last_name":"Doe" } }, { "output": "John Black", "search":{ "first_name":"John", "last_name":"Black" } }] }
Before using Elasticsearch, please modify the following keys in the properties file:
Indexing
The class managing the indexing is fr.paris.lutece.plugins.gruindexing.business.elasticsearch.ElasticSearchCustomerDAO. It is also configured as a bean in the Spring context.
The indexing query is defined in the file WEB-INF/plugins/gruindexing/elasticsearch_customer_indexing.template. It contains placeholders (like ${user_cid}) which are replaced with actual values at index-time. Some placeholders are pre-defined:
In the same way, some indexed fields are pre-defined:
In order to use autocomplete search, the template must contain a field suggest and a field payload. The field suggest is an Elasticsearch standard completion field. The field payload must contain the following fields:
"suggest":{ "input":[ "${first_name} ${last_name}", "${last_name} ${first_name}", "${telephoneNumber}", "${fixed_telephone_number}" ], "payload":{ "output":"${first_name} ${last_name}", "search":{ "first_name":"${first_name}", "last_name":"${last_name}" } } }
"suggest":{ "input":[ "${first_name} ${last_name}", "${last_name} ${first_name}", "${telephoneNumber}", "${fixed_telephone_number}" ] }, "payload":{ "output":"${first_name} ${last_name}", "search":{ "first_name":"${first_name}", "last_name":"${last_name}" } }
Search
The class managing the search is fr.paris.lutece.plugins.gruindexing.business.elasticsearch.ElasticSearchCustomerDAO. It is also configured as a bean in the Spring context.
The search can be configured by modifying the following keys in the properties file:
Autocomplete search
The class managing the autocomplete search is fr.paris.lutece.plugins.gruindexing.web.rs.elasticsearch.ElasticSearchAutoCompleteRestService. It is also configured as a bean in the Spring context. It is a web service which can be called at the URL /rest/elasticsearch/autocomplete with a GET method. The parameter query must contain the term(s) to search.
The autocomplete search query is defined in the file WEB-INF/plugins/gruindexing/elasticsearch_autocomplete.template. It contains a placeholder ${query} which is replaced with the actual search query at search-time.
One can add customized placeholders in this template. In order to replace these placeholders by their actual values, one has to implement the interface fr.paris.lutece.plugins.gruindexing.web.elasticsearch.template.IAutocompletePlaceholderFilter and to declare the implementation as a bean in the Spring context.
The autocomplete search returns a JSON string with the following fields:
{ "autocomplete": [{ "output": "John Doe", "search":{ "first_name":"John", "last_name":"Doe" } }, { "output": "John Black", "search":{ "first_name":"John", "last_name":"Black" } }] }