Source code for the functionality of the site's search engine.
# DACB Site Search Engine
## Description
Source code for the functionality of the site's search engine.
This not only encompasses the build stage — in compiling site data to be searched; and a search phase, which is to be run on the browser to search that compiled data.
## Deployment
The first version of deployment relies on this site being pushed to GitHub pages, and the DACB website requesting the search scripts directly from the GitHub pages URL. However, the current version, while possibly not yet deployed, builds search scripts directly to the DACB website source, meaning that GitHub pages on this site isn't necessary in that iteration. In fact, once that is completely phased out, the additional build directory (`dist`) on this repo could be completely removed too.
## Technologies
The search engine is written in Node.js, and comprises of a single build phase, which builds static JavaScript files to be fetched and run on the client side. These files include the full search functionality, including all of the search index and database necessary for it to function. Simply fetch a built search script, and a global function will be available to easily get results for search queries.
## Building
Information on building the search engine is available on the site documentation.
The current system uses a single build script titled `build`, which calls webpack to first compile a database of pages, and subsequently compile that database as well as the search functionality into the minified output files.
## Performance & Libraries Used
For the content search, Flexsearch is used, and fetched with NPM.
For the lightweight search, which only searches the titles of pages, a simple linear search implementation exists, which is efficient for the current ~3500 pages that are indexed.
## File Structure
The source code is split into three main parts: `compile` to handle compiling all of the page/site database; `data` to store all of the data compiled in `compile`; an …