Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 5.49 KB

README.md

File metadata and controls

69 lines (48 loc) · 5.49 KB

License Language Branches npm jasmine eslint

search-menu-ui-example

This example shows how to use search-menu-ui in conjunction with data-restructor-js as data converter and Elasticsearch as backend.

There are many ways to integrate and design a search UI, this is only one of them.

Notice: It is not recommended to directly access Elasticsearch from the browser. It should be encapsulated and secured within a server application. For fast prototyping and examples like this, it might be handy to directly access it, as long as the HTTP CORS settings work.

The included search-example-servlet shows how to implement a java application using a standard servlet container to integrate elasticsearch into a application like a database.

Notice: This example does not use a bundler and includes all scripts without module system to show, that a minimal-dependencies approach is possible. Both search-menu-ui and data-restructor-js provide built modules and also support the use of bundler.

1. Setup elasticsearch

2. Convert elasticsearch results to the search menu data structure

3. Configure search service backend request

The build-in module search-service-client.js contains a very simple yet useable HTTP client adapter to attach a XMLHttpRequest to the search menu. The example configuration is located inside the search-binding.js. More details can be found here: search-service-client JSDoc.

4. Configure and attach the search menu UI

Finally everything gets assembled and bound to the HTML for this example inside search-binding.js. This example mainly uses default bindings and settings. The only thing that is left is the definition of the modules for the search service, the data converter and the template resolver. addFocusStyleClassOnEveryCreatedElement is additionally used for better browser compatibility (to not depend on CSS :focus selector).

More details and all configuration options can be found here: SearchMenuAPI JSDoc

Credits

Runtime Dependencies

This project builds upon these great libraries at runtime:

Development Dependencies

This project is created using these great tools as development dependencies: