{"action":"created","comment":{"url":"https://api.github.com/repos/TextDB/textdb/pulls/comments/59325135","id":59325135,"diff_hunk":"@@ -0,0 +1,87 @@\n+package edu.uci.ics.textdb.storage;\r\n+\r\n+import java.io.IOException;\r\n+import java.nio.file.Paths;\r\n+import java.util.List;\r\n+\r\n+import org.apache.lucene.analysis.Analyzer;\r\n+import org.apache.lucene.analysis.standard.StandardAnalyzer;\r\n+import org.apache.lucene.document.Document;\r\n+import org.apache.lucene.index.IndexWriter;\r\n+import org.apache.lucene.index.IndexWriterConfig;\r\n+import org.apache.lucene.store.Directory;\r\n+import org.apache.lucene.store.FSDirectory;\r\n+\r\n+import edu.uci.ics.textdb.api.common.IField;\r\n+import edu.uci.ics.textdb.api.common.ITuple;\r\n+import edu.uci.ics.textdb.api.storage.IDataStore;\r\n+import edu.uci.ics.textdb.common.field.Attribute;\r\n+import edu.uci.ics.textdb.common.field.FieldType;\r\n+import edu.uci.ics.textdb.common.utils.Utils;\r\n+\r\n+public class LuceneDataStore implements IDataStore{\r\n+    \r\n+    private String indexDir;\r\n+\r\n+    public LuceneDataStore(String indexDir) {\r\n+        this.indexDir = indexDir;\r\n+    }\r\n+    \r\n+    public void clearData() throws Exception{\r\n+        IndexWriter indexWriter = null;\r\n+        try {\r\n+            Directory directory = FSDirectory.open(Paths\r\n+                    .get(indexDir));\r\n+            Analyzer analyzer = new StandardAnalyzer();\r\n+            IndexWriterConfig conf = new IndexWriterConfig(analyzer);\r\n+            indexWriter = new IndexWriter(directory, conf);\r\n+            indexWriter.deleteAll();\r\n+        } catch (Exception e) {\r\n+            e.printStackTrace();\r\n+            throw e;\r\n+        } finally {\r\n+            if (indexWriter != null) {\r\n+                indexWriter.close();\r\n+            }\r\n+        }\r\n+        \r\n+    }\r\n+    \r\n+    public void storeData(List<Attribute> schema, List<ITuple> tuples) throws Exception {\r","path":"textdb/textdb-storage/src/main/java/edu/uci/ics/textdb/storage/LuceneDataStore.java","position":50,"original_position":50,"commit_id":"731cd24f3e376e7e6519776acd280106c5ce2b8d","original_commit_id":"34eea5271c9efe388fd29e19b78c78d284b0f445","user":{"login":"JavierJia","id":910229,"avatar_url":"https://avatars.githubusercontent.com/u/910229?v=3","gravatar_id":"","url":"https://api.github.com/users/JavierJia","html_url":"https://github.com/JavierJia","followers_url":"https://api.github.com/users/JavierJia/followers","following_url":"https://api.github.com/users/JavierJia/following{/other_user}","gists_url":"https://api.github.com/users/JavierJia/gists{/gist_id}","starred_url":"https://api.github.com/users/JavierJia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JavierJia/subscriptions","organizations_url":"https://api.github.com/users/JavierJia/orgs","repos_url":"https://api.github.com/users/JavierJia/repos","events_url":"https://api.github.com/users/JavierJia/events{/privacy}","received_events_url":"https://api.github.com/users/JavierJia/received_events","type":"User","site_admin":false},"body":"Should we pull this method to the interface?","created_at":"2016-04-12T06:14:14Z","updated_at":"2016-04-12T06:14:14Z","html_url":"https://github.com/TextDB/textdb/pull/51#discussion_r59325135","pull_request_url":"https://api.github.com/repos/TextDB/textdb/pulls/51","_links":{"self":{"href":"https://api.github.com/repos/TextDB/textdb/pulls/comments/59325135"},"html":{"href":"https://github.com/TextDB/textdb/pull/51#discussion_r59325135"},"pull_request":{"href":"https://api.github.com/repos/TextDB/textdb/pulls/51"}}},"pull_request":{"url":"https://api.github.com/repos/TextDB/textdb/pulls/51","id":65951049,"html_url":"https://github.com/TextDB/textdb/pull/51","diff_url":"https://github.com/TextDB/textdb/pull/51.diff","patch_url":"https://github.com/TextDB/textdb/pull/51.patch","issue_url":"https://api.github.com/repos/TextDB/textdb/issues/51","number":51,"state":"open","locked":false,"title":"Data Storage and Field Types Support","user":{"login":"sandeepreddy602","id":555115,"avatar_url":"https://avatars.githubusercontent.com/u/555115?v=3","gravatar_id":"","url":"https://api.github.com/users/sandeepreddy602","html_url":"https://github.com/sandeepreddy602","followers_url":"https://api.github.com/users/sandeepreddy602/followers","following_url":"https://api.github.com/users/sandeepreddy602/following{/other_user}","gists_url":"https://api.github.com/users/sandeepreddy602/gists{/gist_id}","starred_url":"https://api.github.com/users/sandeepreddy602/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandeepreddy602/subscriptions","organizations_url":"https://api.github.com/users/sandeepreddy602/orgs","repos_url":"https://api.github.com/users/sandeepreddy602/repos","events_url":"https://api.github.com/users/sandeepreddy602/events{/privacy}","received_events_url":"https://api.github.com/users/sandeepreddy602/received_events","type":"User","site_admin":false},"body":"@chenlica @JavierJia .. Moved the data store related classes to storage project. Added support for different field types. Please review the changes.","created_at":"2016-04-11T07:37:07Z","updated_at":"2016-04-12T06:14:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba13ae5e31b2f96e95fcb2b11ecd0f37df9ec188","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/TextDB/textdb/pulls/51/commits","review_comments_url":"https://api.github.com/repos/TextDB/textdb/pulls/51/comments","review_comment_url":"https://api.github.com/repos/TextDB/textdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TextDB/textdb/issues/51/comments","statuses_url":"https://api.github.com/repos/TextDB/textdb/statuses/731cd24f3e376e7e6519776acd280106c5ce2b8d","head":{"label":"TextDB:dataStore","ref":"dataStore","sha":"731cd24f3e376e7e6519776acd280106c5ce2b8d","user":{"login":"TextDB","id":18126950,"avatar_url":"https://avatars.githubusercontent.com/u/18126950?v=3","gravatar_id":"","url":"https://api.github.com/users/TextDB","html_url":"https://github.com/TextDB","followers_url":"https://api.github.com/users/TextDB/followers","following_url":"https://api.github.com/users/TextDB/following{/other_user}","gists_url":"https://api.github.com/users/TextDB/gists{/gist_id}","starred_url":"https://api.github.com/users/TextDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TextDB/subscriptions","organizations_url":"https://api.github.com/users/TextDB/orgs","repos_url":"https://api.github.com/users/TextDB/repos","events_url":"https://api.github.com/users/TextDB/events{/privacy}","received_events_url":"https://api.github.com/users/TextDB/received_events","type":"Organization","site_admin":false},"repo":{"id":53976910,"name":"textdb","full_name":"TextDB/textdb","owner":{"login":"TextDB","id":18126950,"avatar_url":"https://avatars.githubusercontent.com/u/18126950?v=3","gravatar_id":"","url":"https://api.github.com/users/TextDB","html_url":"https://github.com/TextDB","followers_url":"https://api.github.com/users/TextDB/followers","following_url":"https://api.github.com/users/TextDB/following{/other_user}","gists_url":"https://api.github.com/users/TextDB/gists{/gist_id}","starred_url":"https://api.github.com/users/TextDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TextDB/subscriptions","organizations_url":"https://api.github.com/users/TextDB/orgs","repos_url":"https://api.github.com/users/TextDB/repos","events_url":"https://api.github.com/users/TextDB/events{/privacy}","received_events_url":"https://api.github.com/users/TextDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TextDB/textdb","description":"Text-centric data management system","fork":false,"url":"https://api.github.com/repos/TextDB/textdb","forks_url":"https://api.github.com/repos/TextDB/textdb/forks","keys_url":"https://api.github.com/repos/TextDB/textdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TextDB/textdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TextDB/textdb/teams","hooks_url":"https://api.github.com/repos/TextDB/textdb/hooks","issue_events_url":"https://api.github.com/repos/TextDB/textdb/issues/events{/number}","events_url":"https://api.github.com/repos/TextDB/textdb/events","assignees_url":"https://api.github.com/repos/TextDB/textdb/assignees{/user}","branches_url":"https://api.github.com/repos/TextDB/textdb/branches{/branch}","tags_url":"https://api.github.com/repos/TextDB/textdb/tags","blobs_url":"https://api.github.com/repos/TextDB/textdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TextDB/textdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TextDB/textdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/TextDB/textdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TextDB/textdb/statuses/{sha}","languages_url":"https://api.github.com/repos/TextDB/textdb/languages","stargazers_url":"https://api.github.com/repos/TextDB/textdb/stargazers","contributors_url":"https://api.github.com/repos/TextDB/textdb/contributors","subscribers_url":"https://api.github.com/repos/TextDB/textdb/subscribers","subscription_url":"https://api.github.com/repos/TextDB/textdb/subscription","commits_url":"https://api.github.com/repos/TextDB/textdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/TextDB/textdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/TextDB/textdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/TextDB/textdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/TextDB/textdb/contents/{+path}","compare_url":"https://api.github.com/repos/TextDB/textdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TextDB/textdb/merges","archive_url":"https://api.github.com/repos/TextDB/textdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TextDB/textdb/downloads","issues_url":"https://api.github.com/repos/TextDB/textdb/issues{/number}","pulls_url":"https://api.github.com/repos/TextDB/textdb/pulls{/number}","milestones_url":"https://api.github.com/repos/TextDB/textdb/milestones{/number}","notifications_url":"https://api.github.com/repos/TextDB/textdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TextDB/textdb/labels{/name}","releases_url":"https://api.github.com/repos/TextDB/textdb/releases{/id}","deployments_url":"https://api.github.com/repos/TextDB/textdb/deployments","created_at":"2016-03-15T20:38:46Z","updated_at":"2016-04-06T19:07:11Z","pushed_at":"2016-04-12T02:37:32Z","git_url":"git://github.com/TextDB/textdb.git","ssh_url":"git@github.com:TextDB/textdb.git","clone_url":"https://github.com/TextDB/textdb.git","svn_url":"https://github.com/TextDB/textdb","homepage":null,"size":305,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":15,"forks":2,"open_issues":15,"watchers":7,"default_branch":"master"}},"base":{"label":"TextDB:master","ref":"master","sha":"227e8ca850f8534f20fd10805d418cc12a4ceace","user":{"login":"TextDB","id":18126950,"avatar_url":"https://avatars.githubusercontent.com/u/18126950?v=3","gravatar_id":"","url":"https://api.github.com/users/TextDB","html_url":"https://github.com/TextDB","followers_url":"https://api.github.com/users/TextDB/followers","following_url":"https://api.github.com/users/TextDB/following{/other_user}","gists_url":"https://api.github.com/users/TextDB/gists{/gist_id}","starred_url":"https://api.github.com/users/TextDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TextDB/subscriptions","organizations_url":"https://api.github.com/users/TextDB/orgs","repos_url":"https://api.github.com/users/TextDB/repos","events_url":"https://api.github.com/users/TextDB/events{/privacy}","received_events_url":"https://api.github.com/users/TextDB/received_events","type":"Organization","site_admin":false},"repo":{"id":53976910,"name":"textdb","full_name":"TextDB/textdb","owner":{"login":"TextDB","id":18126950,"avatar_url":"https://avatars.githubusercontent.com/u/18126950?v=3","gravatar_id":"","url":"https://api.github.com/users/TextDB","html_url":"https://github.com/TextDB","followers_url":"https://api.github.com/users/TextDB/followers","following_url":"https://api.github.com/users/TextDB/following{/other_user}","gists_url":"https://api.github.com/users/TextDB/gists{/gist_id}","starred_url":"https://api.github.com/users/TextDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TextDB/subscriptions","organizations_url":"https://api.github.com/users/TextDB/orgs","repos_url":"https://api.github.com/users/TextDB/repos","events_url":"https://api.github.com/users/TextDB/events{/privacy}","received_events_url":"https://api.github.com/users/TextDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TextDB/textdb","description":"Text-centric data management system","fork":false,"url":"https://api.github.com/repos/TextDB/textdb","forks_url":"https://api.github.com/repos/TextDB/textdb/forks","keys_url":"https://api.github.com/repos/TextDB/textdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TextDB/textdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TextDB/textdb/teams","hooks_url":"https://api.github.com/repos/TextDB/textdb/hooks","issue_events_url":"https://api.github.com/repos/TextDB/textdb/issues/events{/number}","events_url":"https://api.github.com/repos/TextDB/textdb/events","assignees_url":"https://api.github.com/repos/TextDB/textdb/assignees{/user}","branches_url":"https://api.github.com/repos/TextDB/textdb/branches{/branch}","tags_url":"https://api.github.com/repos/TextDB/textdb/tags","blobs_url":"https://api.github.com/repos/TextDB/textdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TextDB/textdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TextDB/textdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/TextDB/textdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TextDB/textdb/statuses/{sha}","languages_url":"https://api.github.com/repos/TextDB/textdb/languages","stargazers_url":"https://api.github.com/repos/TextDB/textdb/stargazers","contributors_url":"https://api.github.com/repos/TextDB/textdb/contributors","subscribers_url":"https://api.github.com/repos/TextDB/textdb/subscribers","subscription_url":"https://api.github.com/repos/TextDB/textdb/subscription","commits_url":"https://api.github.com/repos/TextDB/textdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/TextDB/textdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/TextDB/textdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/TextDB/textdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/TextDB/textdb/contents/{+path}","compare_url":"https://api.github.com/repos/TextDB/textdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TextDB/textdb/merges","archive_url":"https://api.github.com/repos/TextDB/textdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TextDB/textdb/downloads","issues_url":"https://api.github.com/repos/TextDB/textdb/issues{/number}","pulls_url":"https://api.github.com/repos/TextDB/textdb/pulls{/number}","milestones_url":"https://api.github.com/repos/TextDB/textdb/milestones{/number}","notifications_url":"https://api.github.com/repos/TextDB/textdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TextDB/textdb/labels{/name}","releases_url":"https://api.github.com/repos/TextDB/textdb/releases{/id}","deployments_url":"https://api.github.com/repos/TextDB/textdb/deployments","created_at":"2016-03-15T20:38:46Z","updated_at":"2016-04-06T19:07:11Z","pushed_at":"2016-04-12T02:37:32Z","git_url":"git://github.com/TextDB/textdb.git","ssh_url":"git@github.com:TextDB/textdb.git","clone_url":"https://github.com/TextDB/textdb.git","svn_url":"https://github.com/TextDB/textdb","homepage":null,"size":305,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":15,"forks":2,"open_issues":15,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TextDB/textdb/pulls/51"},"html":{"href":"https://github.com/TextDB/textdb/pull/51"},"issue":{"href":"https://api.github.com/repos/TextDB/textdb/issues/51"},"comments":{"href":"https://api.github.com/repos/TextDB/textdb/issues/51/comments"},"review_comments":{"href":"https://api.github.com/repos/TextDB/textdb/pulls/51/comments"},"review_comment":{"href":"https://api.github.com/repos/TextDB/textdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TextDB/textdb/pulls/51/commits"},"statuses":{"href":"https://api.github.com/repos/TextDB/textdb/statuses/731cd24f3e376e7e6519776acd280106c5ce2b8d"}}}}