Search Engines
Workshop | Build a Reverse Index
yash101
Published 2/7/2025
Updated 2/7/2025
Jump to Page 📚
In this part, you will use an interactive IDE in your browser to implement your own index and query functions on a reverse index. Part 4 will have the working solution.
Below is an editor. The search and index functions are unimplemented. Try to implement both functions and get the search engine working. The driver code in this workshop will download Æsop’s Fables as a JSON, attempt to index your code, and attempt to search a few queries.
#
✅ Expected output
Query: wolf results: 24
Hits: 2 document: The Kid and the Wolf
Hits: 2 document: The Wolf and the Lion
Hits: 1 document: The Wolf And The Lamb
Hits: 1 document: The Kingdom of the Lion
Hits: 1 document: The Wolf and the Crane
Query: cat results: 6
Hits: 1 document: The Cat and the Cock
Hits: 1 document: The Cat and the Birds
Hits: 1 document: The Mice in Council
Hits: 1 document: The Cat and the Mice
Hits: 1 document: The Eagle, the Cat, and the Wild Sow
Query: dog jumped over wolf and fox results: 298
Hits: 5 document: The Fox and the Monkey
Hits: 5 document: The Kid and the Wolf
Hits: 4 document: The Lion, the Wolf, and the Fox
Hits: 4 document: The Wolf and the Lion
Hits: 4 document: The Fox and the Lion
Query: cat at the mouse then the dog barked at the cat results: 306
Hits: 4 document: The Wolf and the Lion
Hits: 3 document: The Cat and the Birds
Hits: 3 document: The Mice in Council
Hits: 3 document: The Cat and the Mice
Hits: 3 document: The Eagle, the Cat, and the Wild Sow
#A view of
A view of aesop-fables.json
#
🥽 Experimentation
- Try editing the preprocessing
- Try editing the tokenize function
- Try printing parts of your index to inspect it
- Are there any anomalies in the index?
- Try different search queries
#
⏭️ Next Page
The next page has a working solution for the workshop.