This repository contains two minimal, well-tested implementations for multi-term search over documents:
src/inverted_index.py: a classic inverted index with set intersections for AND queries.src/conjunctive_index_binary.py: a binary-encoded variant that treats each document’s term set as a bitmask and answers conjunctive (AND) queries via bitwise checks.
The goal is to show simple, clear baselines for conjunctive (multi-term) search and highlight trade-offs between straightforward posting-list intersections and compact bitmask-based filtering.
For background and motivation, see the article:
Requirements:
- Python 3.8+
Install dev dependency for tests:
pip install -r requirements.txtThis repo is test-first. Run the full test suite with:
pytest -qRelevant tests:
tests/test_inverted_index.pytests/test_conjunctive_index_binary.py