How to start with OramaSearch
Tags: angular, node, orama
Published: 2023-06-04 20:52:17

In this last week, I wanted to try OramaSearch, a new library that is really easy to use to implement fulltext searches.

I wanted to do two simple tests to verify its ease of use and if indeed, as the authors promise, provide results so quickly.

The first test was to create an Angular project, add a service that downloaded a structured JSON of data (in my case related to a list of states of the world), and then use Orama to filter the data based on a text string.

The steps to include and use Orama are:
1. create an angular project
![Create an angular project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r7oi65spoqooefk4zqz9.png)
2. install OramaSearch
![Install OramaSearch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6vz4ym9548udbulihq7.png)
3. create a service to download data from a webservice
![Create a service to download data from a webservice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tu2e5a2gxc1hega7cbb.png)
In my case I used [https://restcountries.com](https://restcountries.com), an Open Source project and free to use, to get country information via a RESTful API.
4. create a database with the desired schema
![Create a database with the desired schema](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2iyst2gyrcffvylgu0we.png)
5. through the service, populate the database
![Through the service, populate the database](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhxakhtq9eevji14i7b3.png)
6. create an interface to display the data list, including search fields (in my case I used AngularMaterial to speed up writing the UI)
7. implement search method
![Implement search method](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/alvuf1n0qos8fg74njd1.png)

If you want to see the complete project, you can find it here [https://github.com/eleonorarocchi/oramaDemo](https://github.com/eleonorarocchi/oramaDemo)

The second test was to implement a NodeJs project. 
As in the previous example, I tried including CountryREST to populate the database, and implement a search method.

The steps to include and use Orama are:
1. initialize it as an npm project:
![Initialize it as an npm project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zrc5u7dhany1kjwv7x2.png)
2. install and set up TypeScript
![Install and set up TypeScript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oyhfcvoqtztzkny11zjg.png)
3. create tsconfig.json
![Create tsconfig.json](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c6o9doogr4v95qvrdo54.png)
4. install the Express framework and create a minimal server
![Install the Express framework](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hsxugffd74z3ckuxc1dd.png)
5. create src/app.ts file
6. in the app.listen method, add the code for initialize the database definition, as in the previous project, and the code for populate database
![Populate db](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1jfxpgad6rrfmmg730ok.png)
7. create a method for see all data
![See all data](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2dwp067hlx4ltn1zoe0.png)
8. create a method for see filtered data, by a parameter
![Filter data](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jbp7im5mw97c6e0q0ezi.png)

It's really simple to integrate and fast to deliver results!

If you want to see the complete project, you can find it here [https://github.com/eleonorarocchi/oramaNodeDemo](https://github.com/eleonorarocchi/oramaNodeDemo)


![https://www.oramasearch.com](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikv7pqc2xymt5s2jw065.png)

You can find more information directly on the project website: [https://www.oramasearch.com](https://www.oramasearch.com)