Seach engine is a simple CLI application to search the data in json file and return the results in table format. This application doesn't support wildcard search. So please input exact value to get certain records. You could search by one object in an array( such as tags:['a', 'b']).
- Clone this repository
- Navigate to your terminal and change your directory to the searchEngine.
- Run
yarn install
to install node dependencies.
Optional
- Run
yarn link
to creates a symbolic link between project directory and executable command.
-
start projet In CLI type
node start.js start
(If you have runyarn link
, you can also start bystartengine start
) -
Search Data
2.1 select file/group and select search field
2.2 Input search value to get result, please input exact data, no wildcard search supported here. You can search by one object in tags.
- User can also export search result to new json file
- User can search again in the same file/different files or just exit
All catch error will be written in error.txt automatically
Search Engine uses Jest as testing framework and there are five testing cases in baseFunctions.test.js.
Run yarn test
to get test suit.
Search Engine is currently extended with the following plugins.
Plugin | README |
---|---|
commander | README.md |
inquirer | README.md |
jsonfile | README.md |
cli-table2 | README.md |
jest | README.md |
- Typescript
Tried to use typescript with Node.js. As a develoepr with object oriented background(Thanks! Java), typescript is a better option for me. Tried to set up once, but there is something wrong with the configuration. Given time frame and scope of this project(ts is more suitable for large application). I chose to stay with Js.
- Mongodb
I was thinking to manage data in json files with Mongodb. That was how I started as well. However, after gave it a second thought, I realized I may make this project complicated. So...no mongdb.
- Error.txt
Error report was in json format. My origin design was to create one error.json file which recorded error occur time, error type and error info. But I couldn't fix appending problem. Tried solution in this, but "read in data --> Object.assign --> write new data " would result block issue. As a result, I replaced json with plain txt