{"id":17166740,"url":"https://github.com/willf/inverted_index","last_synced_at":"2025-10-16T13:41:21.302Z","repository":{"id":66569826,"uuid":"64421945","full_name":"willf/inverted_index","owner":"willf","description":"A simple in memory inverted index in Python","archived":false,"fork":false,"pushed_at":"2016-08-02T22:27:14.000Z","size":26,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T20:13:01.166Z","etag":null,"topics":["python","search-engine"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-28T19:18:56.000Z","updated_at":"2022-08-03T07:14:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"39bca276-a467-40b0-b56c-063b7b832888","html_url":"https://github.com/willf/inverted_index","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willf%2Finverted_index","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willf%2Finverted_index/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willf%2Finverted_index/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willf%2Finverted_index/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willf","download_url":"https://codeload.github.com/willf/inverted_index/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248734053,"owners_count":21153139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","search-engine"],"created_at":"2024-10-14T23:06:31.606Z","updated_at":"2025-10-16T13:41:16.222Z","avatar_url":"https://github.com/willf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Inverted Index\n==============\n\nA simple in-memory inverted index system, with a modest query language.\n\n\n    i = inverted_index.Index()\n    i.index(1, \"this is the day they give babies away with half a pound of tea\")\n    i.index(1, \"if you know any ladies who need any babies just send them round to \")\n    i.index(2, \"babies are born in the circle of the sun\")\n    results, err = i.query(\"babies\")\n    print(results)\n    {1,2}\n    results, err = i.query(\"babies AND ladies\")\n    print(results)\n    {1}\n    i.index(3, \"WHERE ARE THE BABIES\", tokenizer=lambda s:s.lower().split())\n    results, err = i.query(\"babies\")\n    print(results)\n    {1,2,3}\n    i.unindex(3)\n    results, err = i.query(\"babies\")\n    print(results)\n    {1,2}\n\nAny hashable object can be the \"document\", and a tokenizer can be specified to tokenize the\ntext to index. There are also `add_token` and `add_tokens` methods to directly index on individual\ntokens.\n\nThe query language is very simple: it understands AND and OR, NOT, and parentheses. For example:\n\n    term OR term\n    term AND term OR term\n    (term AND term) OR term\n    NOT term\n    NOT term AND (term OR term)\n\n`AND`, `OR`, and `NOT` have equal precedence, so use parentheses to disambiguate.\n\nI'm pretty sure you don't want to use this in production code :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillf%2Finverted_index","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillf%2Finverted_index","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillf%2Finverted_index/lists"}