Search in sources :

Example 1 with ElasticClient

use of org.meveo.service.index.ElasticClient in project meveo by meveo-org.

the class FullTextSearchBean method getEsDataModel.

public LazyDataModel<Map<String, Object>> getEsDataModel(Map<String, Object> inputFilters) {
    if (esDataModel == null) {
        final Map<String, Object> filters = inputFilters;
        esDataModel = new ESBasedDataModel() {

            private static final long serialVersionUID = -1514374110345615089L;

            @Override
            protected String getFullTextSearchValue(Map<String, Object> loadingFilters) {
                return (String) filters.get(ESBasedDataModel.FILTER_FULL_TEXT);
            }

            @Override
            protected ElasticClient getElasticClientImpl() {
                return elasticClient;
            }

            @Override
            public String[] getSearchScope() {
                // Limit search scope to offers, product, offer template categories, user groups for marketing manager application
                if (FullTextSearchBean.this.getCurrentUser().hasRole("marketingCatalogManager") || FullTextSearchBean.this.getCurrentUser().hasRole("marketingCatalogVisualization")) {
                    return new String[] { UserHierarchyLevel.class.getName() };
                }
                return null;
            }
        };
    }
    return esDataModel;
}
Also used : ESBasedDataModel(org.meveo.util.view.ESBasedDataModel) UserHierarchyLevel(org.meveo.model.hierarchy.UserHierarchyLevel) ElasticClient(org.meveo.service.index.ElasticClient)

Aggregations

UserHierarchyLevel (org.meveo.model.hierarchy.UserHierarchyLevel)1 ElasticClient (org.meveo.service.index.ElasticClient)1 ESBasedDataModel (org.meveo.util.view.ESBasedDataModel)1