{"action":"created","issue":{"url":"https://api.github.com/repos/rnewson/couchdb-lucene/issues/264","repository_url":"https://api.github.com/repos/rnewson/couchdb-lucene","labels_url":"https://api.github.com/repos/rnewson/couchdb-lucene/issues/264/labels{/name}","comments_url":"https://api.github.com/repos/rnewson/couchdb-lucene/issues/264/comments","events_url":"https://api.github.com/repos/rnewson/couchdb-lucene/issues/264/events","html_url":"https://github.com/rnewson/couchdb-lucene/issues/264","id":304127560,"number":264,"title":"Search time out after sync local database (PouchDB) with the server","user":{"login":"juliobetta","id":394147,"avatar_url":"https://avatars3.githubusercontent.com/u/394147?v=4","gravatar_id":"","url":"https://api.github.com/users/juliobetta","html_url":"https://github.com/juliobetta","followers_url":"https://api.github.com/users/juliobetta/followers","following_url":"https://api.github.com/users/juliobetta/following{/other_user}","gists_url":"https://api.github.com/users/juliobetta/gists{/gist_id}","starred_url":"https://api.github.com/users/juliobetta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliobetta/subscriptions","organizations_url":"https://api.github.com/users/juliobetta/orgs","repos_url":"https://api.github.com/users/juliobetta/repos","events_url":"https://api.github.com/users/juliobetta/events{/privacy}","received_events_url":"https://api.github.com/users/juliobetta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-11T03:42:31Z","updated_at":"2018-03-12T02:33:55Z","closed_at":null,"author_association":"NONE","body":"I'm using CouchDB 2.0, and I'm calling the search directly from couchdb-lucene url.\r\n\r\n    curl http://couchdb_lucene:5985/local/personalservice%24test/_design/search/by_patient?q=name:bruna\r\n    => { code: 500 }\r\n<img width=\"1040\" alt=\"screenshot\" src=\"https://user-images.githubusercontent.com/394147/37249477-ef8396f8-24c6-11e8-8a0b-d8b34cb9dcc0.png\">\r\n\r\nThe timeout happens *after* I synchronize a local database (PouchDB) with the server.\r\n\r\nBut it works when I run the `info` url.\r\n\r\n    curl http://couchdb_lucene:5985/local/personalservice%24test/_design/search/by_patient\r\n\r\n    {\r\n      \"current\":true,\r\n      \"doc_count\":7582,\r\n      \"digest\":\"dxedi0wt8831hv78xfneis12q\",\r\n      \"update_seq\":\"7591-g1AAAAI7eJzLYWBg4MhgTmHgzcvPy09JdcjLz8gvLskBCjMlMiTJ____PyuDOYmBgXl5LlCM3SzF3Mgs0RRdPQ4TkhSAZJI9wpAzYENMk01NjSyNiTXEAWRIPMKQGWBDUo0MzC0NE4k1JAFkSD26IZbG5uZJZkZEGpLHAiQZGoAU0Jz5UINWgw1KMjC0MDclNlwgBi2AGLQfYhALK8RbKeamJokpJBl0AGLQfaiLtkMCOSUVGECkee0BxCBYGM0FG5Roam5mium1LAAd8KtG\",\r\n      \"disk_size\":706686,\r\n      \"doc_del_count\":0,\r\n      \"fields\":[\r\n        \"name\"\r\n      ],\r\n      \"ref_count\":2,\r\n      \"uuid\":\"2a750a50-eed3-4d2e-a6d3-fc0c533ee335\",\r\n      \"version\":5\r\n    }\r\n\r\nI've made an experience replicating the database in the server, and the issue is gone. I'm trying to understand why the timeout happens only after a synchronization... 🤔 \r\n\r\n        {\r\n            \"q\":\"name:bruna\",\r\n            \"fetch_duration\":10,\r\n            \"total_rows\":2,\r\n            \"limit\":25,\r\n            \"search_duration\":23,\r\n            \"etag\":\"24bed27d9f56\",\r\n            \"skip\":0,\r\n            \"rows\":[\r\n                {\r\n                \"score\":4.144786834716797,\r\n                \"id\":\"patients_01C83AAFYM87ZRV42NYXXGWAXK\",\r\n                \"fields\":{\r\n                    \"name\":\"Bruna Barros\"\r\n                }\r\n                },\r\n                {\r\n                \"score\":4.144786834716797,\r\n                \"id\":\"patients_01C83AAEZ5YMSG8CKB84MM6K99\",\r\n                \"fields\":{\r\n                    \"name\":\"Bruna Moreira\"\r\n                }\r\n                }\r\n            ]\r\n        }"},"comment":{"url":"https://api.github.com/repos/rnewson/couchdb-lucene/issues/comments/372177589","html_url":"https://github.com/rnewson/couchdb-lucene/issues/264#issuecomment-372177589","issue_url":"https://api.github.com/repos/rnewson/couchdb-lucene/issues/264","id":372177589,"user":{"login":"juliobetta","id":394147,"avatar_url":"https://avatars3.githubusercontent.com/u/394147?v=4","gravatar_id":"","url":"https://api.github.com/users/juliobetta","html_url":"https://github.com/juliobetta","followers_url":"https://api.github.com/users/juliobetta/followers","following_url":"https://api.github.com/users/juliobetta/following{/other_user}","gists_url":"https://api.github.com/users/juliobetta/gists{/gist_id}","starred_url":"https://api.github.com/users/juliobetta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliobetta/subscriptions","organizations_url":"https://api.github.com/users/juliobetta/orgs","repos_url":"https://api.github.com/users/juliobetta/repos","events_url":"https://api.github.com/users/juliobetta/events{/privacy}","received_events_url":"https://api.github.com/users/juliobetta/received_events","type":"User","site_admin":false},"created_at":"2018-03-12T02:33:55Z","updated_at":"2018-03-12T02:33:55Z","author_association":"NONE","body":"I've solved this issue by removing `?limit=0&descending=true` from the line below. \r\n\r\nhttps://github.com/rnewson/couchdb-lucene/blob/5106b033ebfb248b9274eca1f4176cdb2e3d312b/src/main/java/com/github/rnewson/couchdb/lucene/couchdb/Database.java#L102\r\n\r\nThe timeout was  happening because the `last_seq` returned from this method was always different from `update_seq` returned by `<couchd_url>/<database_name>`. I don't know the implications of this change, so I didn't send a PR. Maybe you have a better solutions for this... \r\n"}}
{"actor":{"display_login":"juliobetta"}}