Datagateway Search - ral-facilities/scigateway GitHub Wiki

The datagateway-search plugin is split into two logical components: the search box and the search table. The search box handles modifying and sending search requests while the table presents the retrieved data. These are contained and formatted in an overall component src/searchPageContainer.tsx which can be seen in src/App.tsx

Search Box

The search box is a material-ui grid made up of several sub-components which can be inspected in src/search/ :

  • SearchTextBox
  • SelectDates
  • CheckboxesGroup
  • SearchButton

The first three components take user input to modify the parameters sent to the search library Lucene. Users may filter by date, search string and the type of data entity they would like to search (Dataset, Datafile and Investigation).

These parameters are saved to the Redux store for retrieval and use by the SearchButton. This component contains both functionality for rendering the user interface search button and for handling the Lucene request. (It is good practice to separate UI from functionality so this will require a refactor.) The SearchButton formats the input parameters to build and send a request URL to Lucene which then returns a list of matching data ids.

Search Table

On sending a search request the searchPageTable will render a tabpanel containing a table for each of the entity types:

  • datafileSearchTable
  • datasetSearchTable
  • investigationSearchTable

The data is retrieved using the ids in the Redux store provided from the Lucene search. The Lucene ids are provided as an argument to a Redux action called fetchData which dispatches a data entity specific function (e.g. fetchDatafiles).
Sending a request with blank fields will default to retrieving the entire dataset.

The data fetch and filter functions that the search table uses are imported from datagateway-common. datagateway-table also depends on these shared resources and so datagateway-search displays similar behaviour to that plugin and has a comparable table format. For instance it is possible to sort and filter the table columns and add selected data to a cart. Descriptions of the behaviour of the column filters and cart can be found at the dg-table wiki page.