4.1. Search¶
The search feature in Ngenea Hub allows you to easily find files and folders across different sites. Setting it up correctly will ensure that you can use this powerful tool to quickly locate files when needed.
4.1.1. Requirements¶
The search feature works with systems running on PixStor, which is the platform that powers Ngenea Hub. There are two search options available: PixStor Search and PixStor Analytics.
This guide assumes that one of these options has already been set up as part of your PixStor installation.
4.1.2. Configuration Steps¶
There are two main configurations you need to consider to set up search properly.
4.1.2.1. Choose Your Search Backend¶
Depending on the version of Ngenea Hub you’re using, the system may utilize either the Analytics Backend or the PixStor Search Backend for handling search functionality. Both backends provide the same core features, but you might need to switch between them based on your system’s specific configuration.
If you want to switch from the default Analytics Backend to the PixStor Search backend, it’s simple to do, and no coding is required. You can change the setting by sending a request through a command. Here’s how:
Option 1: Using curl
curl
is a tool that allows you to interact with online services from the command line. To switch to the PixStor Search backend, use the following command:
curl -s -X PATCH 'http://example.com/api/configurations/' -H 'Accept: application/json' -H "Authorization: Bearer $JWT_ACCESS_TOKEN" -H 'Content-Type: application/json' -d '{"search_backend": "pixstor_search"}'
Replace http://example.com with your system’s actual address.
$JWT_ACCESS_TOKEN should be replaced with your valid access token, which is required for authentication.
This command will update the configuration of your system to use PixStor Search instead of the default Analytics Backend.
Option 2: Using ngcurl
If you have ngcurl
installed and configured on your system, you can use this simpler command:
ngcurl patch configurations '{"search_backend": "pixstor_search"}'
This will also switch the search backend to PixStor Search. Both options achieve the same result; you can choose the one that fits your setup.
Note: To understand in detail please refer to the Global Congiguration documentation.
4.1.2.2. Set the Elasticsearch URL¶
If you’re using the Analytics backend and your system is running on PixStor 6, you’ll need to adjust the Elasticsearch URL to ensure the system can find the right data. The new address will be http://localhost:19200
.
If you’re using PixStor 5, the default address localhost:9200
will work fine, and you don’t need to change anything.
Here’s an example of how to update this setting for PixStor 6:
$ curl -s -X PATCH 'http://example.com/api/sites/1/' -H 'Accept: application/json' -H "Authorization: Api-Key $APIKEY" -H 'Content-Type: application/json' -d '{"elasticsearch_url": "localhost:19200"}'
Note: To understand in detail please refer to the Site-specific Configurations documentation.
4.1.3. Using the Search Feature¶
Once everything is set up, you can begin using the search feature in Ngenea Hub.
Search via REST API:
The search functionality can be accessed through the Ngenea Hub’s REST API. This is a great option if you’re comfortable with using API tools. For details on how to use search via the REST API, refer to Search
Search via the Ngenea Hub User Interface (UI):
If you prefer a more user-friendly option, you can enable the search feature in the Ngenea Hub interface. To do this, you’ll need to activate the searchui
feature flag. To understand in detail please refer to Feature Flags This will allow you to use search directly from the Ngenea Hub interface without needing to work with APIs.
Enabling the search UI can be done using a simple command like ngclient :
ngclient features enable searchui
Once enabled, you’ll be able to easily search for files across sites directly from the Ngenea Hub interface.