{"id":19671990,"url":"https://github.com/michelp/xodb","last_synced_at":"2025-04-29T01:30:39.377Z","repository":{"id":4713046,"uuid":"5860966","full_name":"michelp/xodb","owner":"michelp","description":"Xapian python object database","archived":false,"fork":false,"pushed_at":"2013-09-16T20:45:24.000Z","size":356,"stargazers_count":9,"open_issues_count":1,"forks_count":6,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-14T21:55:56.984Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michelp.png","metadata":{"files":{"readme":"README.txt","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}},"created_at":"2012-09-18T18:30:00.000Z","updated_at":"2022-05-28T09:34:03.000Z","dependencies_parsed_at":"2022-09-12T01:30:29.865Z","dependency_job_id":null,"html_url":"https://github.com/michelp/xodb","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/michelp%2Fxodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fxodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fxodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fxodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michelp","download_url":"https://codeload.github.com/michelp/xodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251415583,"owners_count":21585857,"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":[],"created_at":"2024-11-11T17:10:30.561Z","updated_at":"2025-04-29T01:30:39.064Z","avatar_url":"https://github.com/michelp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nxodb is a Xapian object database for Python.\n\nFor information on Xapian, please go to http://xapian.org\n\nXapian stores information in database records called documents.  xodb\nis a library which takes ordinary python objects and converts them\ninto xapian documents.  This database can then be queried for\ndocuments that match a xapian query language expression.\n\nThere are main usage patters in xodb, indexing, and querying.\n\nIndexing\n--------\n\nIndexing is acomplished by defining a *Schema* object that describes\nhow a python object of a certain type is used to generate a xapian\ndocument.  For example, here is 'Department' class that has a name,\nand a list of employees::\n\n  class Department(object):\n\n      def __init__(self, name, employees):\n          self.name = name\n          self.employees = employees\n\n\nInstaces of this python class could be described using the following\nSchema::\n\n  from xodb import Schema, String, Array\n\n  class DepartmentSchema(Schema):\n\n      language = String.using(default=\"en\")\n      name = String.using(facet=True)\n      employees = Array.of(String.using(facet=True))\n\nThe schema tells xodb that the object will have the fields language,\nname, and employees.  The first two are strings, and the third is an\narray of string.  Note that the object definition above does not\nprovide a language, in this case, the provided default \"en\" will be\nused.\n\nNow a new xapian database can be created with xodb::\n\n  import xodb\n\n  db = xodb.temp()\n\nNext, tell xodb that the DepartmentSchema describes the Department type::\n\n  db.map(Department, DepartmentSchema)\n\nNow, create some departments::\n\n  housing = Department(\"housing\", ['bob', 'jane'])\n  monkeys = Department(\"monkeys\", ['bob', rick])\n\nand add them to the database:\n\n  db.add(housing, monkeys)\n\nSince we are done adding objects, flush the changes to disk so that\nother xapian readers can see the new data::\n\n  db.flush()\n\nAnd that's it, now we can query for the data.\n\nQuerying\n--------\n\nData is queried out of xapian using the standard xapian QueryParser\nquery language syntax.  xodb passes the query you provide, straight\ninto the query parser, so the xapian documentation is the best source\nfor exact syntax documentation.\n\nIn general however the syntax follows a simple \"search engine\"\nexpression language where a user can enter a bunch of terms, or terms\nprefixed with a \"name:\" prefix.  For example:\n\n  assert db.query(\"name:monkeys\").next().name == 'monkeys\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichelp%2Fxodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichelp%2Fxodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichelp%2Fxodb/lists"}