{"action":"created","issue":{"url":"https://api.github.com/repos/alimanfoo/petl/issues/313","labels_url":"https://api.github.com/repos/alimanfoo/petl/issues/313/labels{/name}","comments_url":"https://api.github.com/repos/alimanfoo/petl/issues/313/comments","events_url":"https://api.github.com/repos/alimanfoo/petl/issues/313/events","html_url":"https://github.com/alimanfoo/petl/issues/313","id":56810398,"number":313,"title":"Whoosh example is not working...","user":{"login":"stancikcom","id":7148270,"avatar_url":"https://avatars.githubusercontent.com/u/7148270?v=3","gravatar_id":"","url":"https://api.github.com/users/stancikcom","html_url":"https://github.com/stancikcom","followers_url":"https://api.github.com/users/stancikcom/followers","following_url":"https://api.github.com/users/stancikcom/following{/other_user}","gists_url":"https://api.github.com/users/stancikcom/gists{/gist_id}","starred_url":"https://api.github.com/users/stancikcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stancikcom/subscriptions","organizations_url":"https://api.github.com/users/stancikcom/orgs","repos_url":"https://api.github.com/users/stancikcom/repos","events_url":"https://api.github.com/users/stancikcom/events{/privacy}","received_events_url":"https://api.github.com/users/stancikcom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-06T13:16:04Z","updated_at":"2015-03-18T14:16:55Z","closed_at":null,"body":"Hi guys,\r\n\r\nseems that the Petl - Whoosh adapter seems not to work, or I do not know where I do a mistake.\r\n\r\n\r\nTested on:\r\n* Python 2.7.4  32-bit\r\n* Petl version 1.0.4\r\n* Whoosh version 2.2.2\r\n\r\nwith the following code (taken from Petl manual)\r\n```\r\nimport petl as etl\r\n# set up an index and load some documents via the Whoosh API\r\nfrom whoosh.index import create_in\r\nfrom whoosh.fields import *\r\n\r\nprint whoosh.__version__\r\nprint etl.__version__\r\n\r\nschema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)\r\n\r\ndirname = \"example.whoosh\"\r\nif not os.path.exists(dirname):\r\n\tos.mkdir(dirname)\r\n\r\nindex = create_in(dirname, schema)\r\nwriter = index.writer()\r\nwriter.add_document(title=u\"First document\", path=u\"/a\", content=u\"This is the first document we’ve added!\")\r\nwriter.add_document(title=u\"Second document\", path=u\"/b\", content=u\"The second one is even more interesting!\")\r\nwriter.commit()\r\n\r\n# extract documents as a table\r\ntable = etl.fromtextindex(dirname)\r\nprint type(table)\r\nprint repr(table)\r\n```\r\nends with following exception:\r\n```\r\n(2, 2, 2)\r\n1.0.4\r\n<class 'petl.io.whoosh.TextIndexView'>\r\nTraceback (most recent call last):\r\n  File \"C:\\Python27\\mywhoo2.py\", line 38, in <module>\r\n    print repr(table)\r\n  File \"C:\\Python27\\lib\\site-packages\\petl\\util\\vis.py\", line 135, in _table_repr\r\n    return str(look(table))\r\n  File \"C:\\Python27\\lib\\site-packages\\petl\\util\\vis.py\", line 104, in __repr__\r\n    table, overflow = _vis_overflow(self.table, self.limit)\r\n  File \"C:\\Python27\\lib\\site-packages\\petl\\util\\vis.py\", line 528, in _vis_overflow\r\n    table = list(islice(table, 0, limit+2))\r\n  File \"C:\\Python27\\lib\\site-packages\\petl\\io\\whoosh.py\", line 102, in itertextindex\r\n    for _, stored_fields_dict in index.reader().iter_docs():\r\nAttributeError: 'SegmentReader' object has no attribute 'iter_docs'\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/alimanfoo/petl/issues/comments/82992574","html_url":"https://github.com/alimanfoo/petl/issues/313#issuecomment-82992574","issue_url":"https://api.github.com/repos/alimanfoo/petl/issues/313","id":82992574,"user":{"login":"alimanfoo","id":703554,"avatar_url":"https://avatars.githubusercontent.com/u/703554?v=3","gravatar_id":"","url":"https://api.github.com/users/alimanfoo","html_url":"https://github.com/alimanfoo","followers_url":"https://api.github.com/users/alimanfoo/followers","following_url":"https://api.github.com/users/alimanfoo/following{/other_user}","gists_url":"https://api.github.com/users/alimanfoo/gists{/gist_id}","starred_url":"https://api.github.com/users/alimanfoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alimanfoo/subscriptions","organizations_url":"https://api.github.com/users/alimanfoo/orgs","repos_url":"https://api.github.com/users/alimanfoo/repos","events_url":"https://api.github.com/users/alimanfoo/events{/privacy}","received_events_url":"https://api.github.com/users/alimanfoo/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T14:16:54Z","updated_at":"2015-03-18T14:16:54Z","body":"Hi Martin,\n\nOn Wednesday, 18 March 2015, Martin Stancik <notifications@github.com>\nwrote:\n\n>\n>    1.\n>\n>    Which 'all' platforms it should support?\n>\n> I currently test under Linux (Ubuntu 14.10) and Windows 7, under Python\n2.6, 2.7 and 3.4.\n>\n>\n>    1.\n>\n>    Maintain legacy adapters for all possible combinations might be too\n>    expensive... Perhaps would be sufficient to shadow external modules into try\n>    - except sandbox and perform version check only in case an API related\n>    exception is cought. I already have few ideas for a generic solution.\n>\n> For the optional dependencies, if you have the time to write a legacy\nadapter then I'm all for it. However if you're worried about maintenance\neffort then I'm happy to only support some subset of versions with a\nconsistent API. N.b., if we do want to support multiple versions of a\ndependency across some API change then we should probably add another test\nenvironment to the tox setup to ensure coverage.\n\n>\n>    1.\n>\n>    I still consider is worth to maintain legacy adapter / cross-check\n>    against a \"dependency hell\" with the latest versions of petl's optional\n>    modules.\n>\n> See comment above.\n\nCheers,\nAlistair\n\n>\n>    1.\n>\n> --\n> Reply to this email directly or view it on GitHub\n> <https://github.com/alimanfoo/petl/issues/313#issuecomment-82880527>.\n>\n\n\n-- \nAlistair Miles\nHead of Epidemiological Informatics\nCentre for Genomics and Global Health <http://cggh.org>\nThe Wellcome Trust Centre for Human Genetics\nRoosevelt Drive\nOxford\nOX3 7BN\nUnited Kingdom\nWeb: http://purl.org/net/aliman\nEmail: alimanfoo@gmail.com\nTel: +44 (0)1865 287721\n"}}