iDex is a web implemtation of Inverted Index
In computer science, an inverted index (also referred to as postings file or inverted file) is an index data structure storing a mapping from content, such as words or numbers, to its locations in a database file, or in a document or a set of documents (named in contrast to a Forward Index, which maps from documents to content). The purpose of an inverted index is to allow fast full text searches, at a cost of increased processing when a document is added to the database.
- Wikipedia (https://en.wikipedia.org/wiki/Inverted_index)
The inverted index data structure is a central component of a typical search engine indexing algorithm. A goal of a search engine implementation is to optimize the speed of the query: find the documents where word X occurs. Once a forward index is developed, which stores lists of words per document, it is next inverted to develop an inverted index. Querying the forward index would require sequential iteration through each document and to each word to verify a matching document. The time, memory, and processing resources to perform such a query are not always technically realistic. Instead of listing the words per document in the forward index, the inverted index data structure is developed which lists the documents per word. With the inverted index created, the query can now be resolved by jumping to the word ID (via random access) in the inverted index.
- A web browser to run application.
- A Json file with a title and text properties of this format:
[
{
"title": "How to Read a book",
"text": "Men are rational animals. Their rationality agreement is the source of their power to agree. "
},
{
"title": "The Naked Ape.",
"text": "Indeed, we have the most subtle and complex facial expression system of all living animals."
}
]
- On a local environment, Node.js is required
To run on a local environment
Clone or download and unzip this repository into a local directory: git clone https://github.com/Andela-JUdensi/inverted-index.git
On the terminal, change to the containing directory, and run the following commands:
To install dependencies
$ npm install
To run application
$ gulp
or
$ npm start
To run unit test
$ npm test
or
$ gulp test
To run test coverage
to view coverage result in the terminal
$ gulp coverage
to generate the coverage in a .html
$ npm run coverage
- Only .json files can be indexed
- Runs only on the web browser
Fork this repositry to your account. Clone your repositry: git clone [email protected]: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.
EcmaScript 6 (JavaScript 2015) Node.js Express.js (Creates server) Angular.js (Frontend ) Gulp (Task Runner) Karma (Generates Test Coverage Folder) Babel (Transpiles from EcmaScript 6 to Ecmascript 5 for browser compatibility) Uglify (Generates minified/compressed versions) Jasmine (Unit test runner)
- Fork this repositry.
- Clone to you local environment: git clone [email protected]:your-username/inverted-index.git
- Create a branch on a feature you want to work on: git checkout -b proposed-feature
- Commit your changes: git commit -m "new stuff added"
- Push to the remote branch: git push origin proposed-feature
- Open a pull request on here