The Inverted index application allows a user to search for text blocks in the array that contain a specified collection of words. The user can upload multiple JSON files with the correct format displayed below and create an indexes for them, search for words in all files and one file.
The link to the hosted application on heroku can be found here
- To use the application locally, clone the repository, type
cd inverted-index
in the command prompt and runnpm install
. It will download all dependencies. - Run
gulp
on the command line to start the application. - Open the application on
http://localhost:8080
. - Create a JSON file with the following format. You can upload multiple files that follows the format below:
[
{
"title": "I am proud to be an Andelan",
"text": "Andela is looking to make world class technology from Africa"
},
{
"title": "The Noisy Neighbours",
"text": "My neighbours have been very noisy lately and this had led to many sleepless nights at home"
}
]
- Click the create index button to create an index
- Click the get index button to see the index for a particular file.
- Enter any text(s) to search for and select the file or all files to search in.
- Press the enter key to perform the search
- Javascript(ECMAScript 2015)
- AngularJS
- Gulp
- Webpack
- Node.js
- To view the test on the browser, type
http://localhost:8082
on the broswer - running
npm test
on the command line also displays the result on the command line
The available endpoints of the api are listed below:
- Instantiate the Class
const InvertedIndex = new InvertedIndex();
- Create Index
const createIndex = InvertedIndex.createIndex(filename, fileContent);
- Get Index
const getIndex = InvertedIndex.getIndex(fileName);
- Search Index
const searchIndex = InvertedIndex.searchIndex(searchTerms, fileName);
The limitations of this api is that the file has to be in a jSON format and also te JSON file has to be an array of Objects. The upload mechanism should allow for text file and also different word documents.
- Fork this repository to your account.
- Clone your repositry: git clone [email protected]:your-username/inverted-index.git OR git clone https://github.com/your-username/inverted-index.git
- Create your feature branch: git checkout -b new-feature
- Commit your changes: git commit -m "did something"
- Push to the remote branch: git push origin new-feature
- Open a pull request.