{"action":"created","comment":{"url":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/comments/67768101","id":67768101,"diff_hunk":"@@ -0,0 +1,163 @@\n+#include <Rcpp.h>\n+#include <xapian.h>\n+#include <cstdlib>\n+#include <fstream>\n+#include <iostream>\n+#include <string>\n+#include <vector>\n+\n+using namespace std;\n+\n+Rcpp::List convertToDataFrame(Rcpp::List list) {\n+  Rcpp::List dataFrame = clone(list);\n+  Rcpp::GenericVector aRow = dataFrame(0);\n+  Rcpp::StringVector rowNames(aRow.length());\n+  \n+  for (int i = 0; i < aRow.length(); ++i) {\n+    char name[5];\n+    sprintf(&(name[0]), \"%d\", i+1);\n+    rowNames(i) = name;\n+  }\n+  \n+  dataFrame.attr(\"row.names\") = rowNames;\n+  Rcpp::StringVector colNames(dataFrame.length());\n+  \n+  int ascii=97;\n+  for (int j = 0; j < dataFrame.length(); ++j) {\n+    char name[6];\n+    //sprintf(&(name[0]), \"%d\", j+1);\n+    sprintf(&(name[0]), \"%c\", char(ascii++));\n+    colNames(j) = name;\n+  }\n+  \n+  dataFrame.attr(\"names\") = colNames;\n+  dataFrame.attr(\"class\") = \"data.frame\";\n+  return dataFrame;\n+}\n+\n+int columnNo( const string & data){\n+  int col=0;\n+  std::istringstream stream(data);\n+  std::string line;\n+  while(std::getline(stream, line)) {\n+    col++;\n+  }\n+  return col;\n+}\n+\n+string rowVal(const string & data,int row){\n+  int r=0;\n+  string val;\n+  std::istringstream stream(data);\n+  std::string line;\n+  while(std::getline(stream, line)) {\n+    if(r==row){\n+      val=line;\n+      break; \n+    }\n+    r++;\n+  }\n+  if(val==\"\")\n+    return \"NA\";\n+  else\n+    return val;\n+}\n+\n+Xapian::Query parseQuery(Rcpp::List & query){\n+  Xapian::Query returnQuery;\n+  if(query.containsElementNamed(\"queryString\")){\n+    \n+    Xapian::QueryParser queryparser;\n+    \n+    if(query.containsElementNamed(\"stemmer\")){\n+      std::string lang=Rcpp::as<std::string>(query[\"stemmer\"]);\n+      queryparser.set_stemmer(Xapian::Stem(lang));\n+    }\n+    \n+    if(query.containsElementNamed(\"strategy\")){\n+      //maybe an if else should be used here\n+    }\n+    else\n+      queryparser.set_stemming_strategy(queryparser.STEM_SOME);\n+    \n+    if(query.containsElementNamed(\"prefix.fields\")){\n+      Rcpp::List prefixFields=query[\"prefix.fields\"];\n+      for( Rcpp::List::iterator it = prefixFields.begin(); it != prefixFields.end(); ++it ) {\n+        Rcpp::List list=it.operator*();\n+        std::string prefix=Rcpp::as<std::string>(list[\"prefix\"]);\n+        std::string fieldName=Rcpp::as<std::string>(list[\"name\"]);\n+        queryparser.add_prefix(fieldName, prefix);\n+      }\n+    }\n+    \n+    std::string aQuery=Rcpp::as<std::string>(query[\"queryString\"]);\n+    returnQuery = queryparser.parse_query(aQuery);\n+  }\n+  \n+  return returnQuery;\n+}\n+\n+//' Search wrapper\n+//'\n+//' @param dbpath\tpath to a Xapian database\n+//' @param queryList    a list of data to create a Xapian::Query \n+//' \n+//' @examples\n+//' \\dontrun{\n+//' db<- c(\"path/to/database\")\n+//' query<-list(queryString=\"watch\",\n+//'             prefix.fields=list(list(prefix=\"S\",name=\"title\"),\n+//'                           list(prefix=\"XD\",name=\"description\")),\n+//'             stemmer=\"en\")\n+//' searchWrapper(db,query)\n+//' }\n+//' \n+//' @return \n+// [[Rcpp::export]]\n+Rcpp::List searchWrapper(Rcpp::CharacterVector & dbpath,Rcpp::List & queryList){\n+  Rcpp::List aQuery=queryList;","path":"src/SearchWrapper.cpp","position":118,"original_position":118,"commit_id":"dc8dc8c79167674083580e2ebc7b46c39eb8e96b","original_commit_id":"dc8dc8c79167674083580e2ebc7b46c39eb8e96b","user":{"login":"jaylett","id":80187,"avatar_url":"https://avatars.githubusercontent.com/u/80187?v=3","gravatar_id":"","url":"https://api.github.com/users/jaylett","html_url":"https://github.com/jaylett","followers_url":"https://api.github.com/users/jaylett/followers","following_url":"https://api.github.com/users/jaylett/following{/other_user}","gists_url":"https://api.github.com/users/jaylett/gists{/gist_id}","starred_url":"https://api.github.com/users/jaylett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaylett/subscriptions","organizations_url":"https://api.github.com/users/jaylett/orgs","repos_url":"https://api.github.com/users/jaylett/repos","events_url":"https://api.github.com/users/jaylett/events{/privacy}","received_events_url":"https://api.github.com/users/jaylett/received_events","type":"User","site_admin":false},"body":"This comes in as a reference, and is passed to `parseQuery` as a reference, so do you need to copy it into a normal variable in the middle?","created_at":"2016-06-20T21:16:43Z","updated_at":"2016-06-20T21:16:43Z","html_url":"https://github.com/amandaJayanetti/RXapian/pull/5#discussion_r67768101","pull_request_url":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/comments/67768101"},"html":{"href":"https://github.com/amandaJayanetti/RXapian/pull/5#discussion_r67768101"},"pull_request":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/5","id":74502220,"html_url":"https://github.com/amandaJayanetti/RXapian/pull/5","diff_url":"https://github.com/amandaJayanetti/RXapian/pull/5.diff","patch_url":"https://github.com/amandaJayanetti/RXapian/pull/5.patch","issue_url":"https://api.github.com/repos/amandaJayanetti/RXapian/issues/5","number":5,"state":"closed","locked":false,"title":"Update NAMESPACE, Add SearchWrapper and tests ","user":{"login":"amandaJayanetti","id":8381238,"avatar_url":"https://avatars.githubusercontent.com/u/8381238?v=3","gravatar_id":"","url":"https://api.github.com/users/amandaJayanetti","html_url":"https://github.com/amandaJayanetti","followers_url":"https://api.github.com/users/amandaJayanetti/followers","following_url":"https://api.github.com/users/amandaJayanetti/following{/other_user}","gists_url":"https://api.github.com/users/amandaJayanetti/gists{/gist_id}","starred_url":"https://api.github.com/users/amandaJayanetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amandaJayanetti/subscriptions","organizations_url":"https://api.github.com/users/amandaJayanetti/orgs","repos_url":"https://api.github.com/users/amandaJayanetti/repos","events_url":"https://api.github.com/users/amandaJayanetti/events{/privacy}","received_events_url":"https://api.github.com/users/amandaJayanetti/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-20T19:52:23Z","updated_at":"2016-06-20T21:16:43Z","closed_at":"2016-06-20T19:59:49Z","merged_at":"2016-06-20T19:59:49Z","merge_commit_sha":"2192ca7e293c61c6b6fb2762be859adc7782198c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/5/commits","review_comments_url":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/5/comments","review_comment_url":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amandaJayanetti/RXapian/issues/5/comments","statuses_url":"https://api.github.com/repos/amandaJayanetti/RXapian/statuses/dc8dc8c79167674083580e2ebc7b46c39eb8e96b","head":{"label":"amandaJayanetti:development","ref":"development","sha":"dc8dc8c79167674083580e2ebc7b46c39eb8e96b","user":{"login":"amandaJayanetti","id":8381238,"avatar_url":"https://avatars.githubusercontent.com/u/8381238?v=3","gravatar_id":"","url":"https://api.github.com/users/amandaJayanetti","html_url":"https://github.com/amandaJayanetti","followers_url":"https://api.github.com/users/amandaJayanetti/followers","following_url":"https://api.github.com/users/amandaJayanetti/following{/other_user}","gists_url":"https://api.github.com/users/amandaJayanetti/gists{/gist_id}","starred_url":"https://api.github.com/users/amandaJayanetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amandaJayanetti/subscriptions","organizations_url":"https://api.github.com/users/amandaJayanetti/orgs","repos_url":"https://api.github.com/users/amandaJayanetti/repos","events_url":"https://api.github.com/users/amandaJayanetti/events{/privacy}","received_events_url":"https://api.github.com/users/amandaJayanetti/received_events","type":"User","site_admin":false},"repo":{"id":59979615,"name":"RXapian","full_name":"amandaJayanetti/RXapian","owner":{"login":"amandaJayanetti","id":8381238,"avatar_url":"https://avatars.githubusercontent.com/u/8381238?v=3","gravatar_id":"","url":"https://api.github.com/users/amandaJayanetti","html_url":"https://github.com/amandaJayanetti","followers_url":"https://api.github.com/users/amandaJayanetti/followers","following_url":"https://api.github.com/users/amandaJayanetti/following{/other_user}","gists_url":"https://api.github.com/users/amandaJayanetti/gists{/gist_id}","starred_url":"https://api.github.com/users/amandaJayanetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amandaJayanetti/subscriptions","organizations_url":"https://api.github.com/users/amandaJayanetti/orgs","repos_url":"https://api.github.com/users/amandaJayanetti/repos","events_url":"https://api.github.com/users/amandaJayanetti/events{/privacy}","received_events_url":"https://api.github.com/users/amandaJayanetti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amandaJayanetti/RXapian","description":"R bindings for Xapian search engine library.","fork":false,"url":"https://api.github.com/repos/amandaJayanetti/RXapian","forks_url":"https://api.github.com/repos/amandaJayanetti/RXapian/forks","keys_url":"https://api.github.com/repos/amandaJayanetti/RXapian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amandaJayanetti/RXapian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amandaJayanetti/RXapian/teams","hooks_url":"https://api.github.com/repos/amandaJayanetti/RXapian/hooks","issue_events_url":"https://api.github.com/repos/amandaJayanetti/RXapian/issues/events{/number}","events_url":"https://api.github.com/repos/amandaJayanetti/RXapian/events","assignees_url":"https://api.github.com/repos/amandaJayanetti/RXapian/assignees{/user}","branches_url":"https://api.github.com/repos/amandaJayanetti/RXapian/branches{/branch}","tags_url":"https://api.github.com/repos/amandaJayanetti/RXapian/tags","blobs_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/refs{/sha}","trees_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amandaJayanetti/RXapian/statuses/{sha}","languages_url":"https://api.github.com/repos/amandaJayanetti/RXapian/languages","stargazers_url":"https://api.github.com/repos/amandaJayanetti/RXapian/stargazers","contributors_url":"https://api.github.com/repos/amandaJayanetti/RXapian/contributors","subscribers_url":"https://api.github.com/repos/amandaJayanetti/RXapian/subscribers","subscription_url":"https://api.github.com/repos/amandaJayanetti/RXapian/subscription","commits_url":"https://api.github.com/repos/amandaJayanetti/RXapian/commits{/sha}","git_commits_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/commits{/sha}","comments_url":"https://api.github.com/repos/amandaJayanetti/RXapian/comments{/number}","issue_comment_url":"https://api.github.com/repos/amandaJayanetti/RXapian/issues/comments{/number}","contents_url":"https://api.github.com/repos/amandaJayanetti/RXapian/contents/{+path}","compare_url":"https://api.github.com/repos/amandaJayanetti/RXapian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amandaJayanetti/RXapian/merges","archive_url":"https://api.github.com/repos/amandaJayanetti/RXapian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amandaJayanetti/RXapian/downloads","issues_url":"https://api.github.com/repos/amandaJayanetti/RXapian/issues{/number}","pulls_url":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls{/number}","milestones_url":"https://api.github.com/repos/amandaJayanetti/RXapian/milestones{/number}","notifications_url":"https://api.github.com/repos/amandaJayanetti/RXapian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amandaJayanetti/RXapian/labels{/name}","releases_url":"https://api.github.com/repos/amandaJayanetti/RXapian/releases{/id}","deployments_url":"https://api.github.com/repos/amandaJayanetti/RXapian/deployments","created_at":"2016-05-30T04:08:03Z","updated_at":"2016-06-07T19:00:52Z","pushed_at":"2016-06-20T20:19:12Z","git_url":"git://github.com/amandaJayanetti/RXapian.git","ssh_url":"git@github.com:amandaJayanetti/RXapian.git","clone_url":"https://github.com/amandaJayanetti/RXapian.git","svn_url":"https://github.com/amandaJayanetti/RXapian","homepage":"","size":739,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"amandaJayanetti:master","ref":"master","sha":"72640ac2f76dee76ca5dd7f04c4782dbc0ce9c0e","user":{"login":"amandaJayanetti","id":8381238,"avatar_url":"https://avatars.githubusercontent.com/u/8381238?v=3","gravatar_id":"","url":"https://api.github.com/users/amandaJayanetti","html_url":"https://github.com/amandaJayanetti","followers_url":"https://api.github.com/users/amandaJayanetti/followers","following_url":"https://api.github.com/users/amandaJayanetti/following{/other_user}","gists_url":"https://api.github.com/users/amandaJayanetti/gists{/gist_id}","starred_url":"https://api.github.com/users/amandaJayanetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amandaJayanetti/subscriptions","organizations_url":"https://api.github.com/users/amandaJayanetti/orgs","repos_url":"https://api.github.com/users/amandaJayanetti/repos","events_url":"https://api.github.com/users/amandaJayanetti/events{/privacy}","received_events_url":"https://api.github.com/users/amandaJayanetti/received_events","type":"User","site_admin":false},"repo":{"id":59979615,"name":"RXapian","full_name":"amandaJayanetti/RXapian","owner":{"login":"amandaJayanetti","id":8381238,"avatar_url":"https://avatars.githubusercontent.com/u/8381238?v=3","gravatar_id":"","url":"https://api.github.com/users/amandaJayanetti","html_url":"https://github.com/amandaJayanetti","followers_url":"https://api.github.com/users/amandaJayanetti/followers","following_url":"https://api.github.com/users/amandaJayanetti/following{/other_user}","gists_url":"https://api.github.com/users/amandaJayanetti/gists{/gist_id}","starred_url":"https://api.github.com/users/amandaJayanetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amandaJayanetti/subscriptions","organizations_url":"https://api.github.com/users/amandaJayanetti/orgs","repos_url":"https://api.github.com/users/amandaJayanetti/repos","events_url":"https://api.github.com/users/amandaJayanetti/events{/privacy}","received_events_url":"https://api.github.com/users/amandaJayanetti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amandaJayanetti/RXapian","description":"R bindings for Xapian search engine library.","fork":false,"url":"https://api.github.com/repos/amandaJayanetti/RXapian","forks_url":"https://api.github.com/repos/amandaJayanetti/RXapian/forks","keys_url":"https://api.github.com/repos/amandaJayanetti/RXapian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amandaJayanetti/RXapian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amandaJayanetti/RXapian/teams","hooks_url":"https://api.github.com/repos/amandaJayanetti/RXapian/hooks","issue_events_url":"https://api.github.com/repos/amandaJayanetti/RXapian/issues/events{/number}","events_url":"https://api.github.com/repos/amandaJayanetti/RXapian/events","assignees_url":"https://api.github.com/repos/amandaJayanetti/RXapian/assignees{/user}","branches_url":"https://api.github.com/repos/amandaJayanetti/RXapian/branches{/branch}","tags_url":"https://api.github.com/repos/amandaJayanetti/RXapian/tags","blobs_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/refs{/sha}","trees_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amandaJayanetti/RXapian/statuses/{sha}","languages_url":"https://api.github.com/repos/amandaJayanetti/RXapian/languages","stargazers_url":"https://api.github.com/repos/amandaJayanetti/RXapian/stargazers","contributors_url":"https://api.github.com/repos/amandaJayanetti/RXapian/contributors","subscribers_url":"https://api.github.com/repos/amandaJayanetti/RXapian/subscribers","subscription_url":"https://api.github.com/repos/amandaJayanetti/RXapian/subscription","commits_url":"https://api.github.com/repos/amandaJayanetti/RXapian/commits{/sha}","git_commits_url":"https://api.github.com/repos/amandaJayanetti/RXapian/git/commits{/sha}","comments_url":"https://api.github.com/repos/amandaJayanetti/RXapian/comments{/number}","issue_comment_url":"https://api.github.com/repos/amandaJayanetti/RXapian/issues/comments{/number}","contents_url":"https://api.github.com/repos/amandaJayanetti/RXapian/contents/{+path}","compare_url":"https://api.github.com/repos/amandaJayanetti/RXapian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amandaJayanetti/RXapian/merges","archive_url":"https://api.github.com/repos/amandaJayanetti/RXapian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amandaJayanetti/RXapian/downloads","issues_url":"https://api.github.com/repos/amandaJayanetti/RXapian/issues{/number}","pulls_url":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls{/number}","milestones_url":"https://api.github.com/repos/amandaJayanetti/RXapian/milestones{/number}","notifications_url":"https://api.github.com/repos/amandaJayanetti/RXapian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amandaJayanetti/RXapian/labels{/name}","releases_url":"https://api.github.com/repos/amandaJayanetti/RXapian/releases{/id}","deployments_url":"https://api.github.com/repos/amandaJayanetti/RXapian/deployments","created_at":"2016-05-30T04:08:03Z","updated_at":"2016-06-07T19:00:52Z","pushed_at":"2016-06-20T20:19:12Z","git_url":"git://github.com/amandaJayanetti/RXapian.git","ssh_url":"git@github.com:amandaJayanetti/RXapian.git","clone_url":"https://github.com/amandaJayanetti/RXapian.git","svn_url":"https://github.com/amandaJayanetti/RXapian","homepage":"","size":739,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/5"},"html":{"href":"https://github.com/amandaJayanetti/RXapian/pull/5"},"issue":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/issues/5"},"comments":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/amandaJayanetti/RXapian/statuses/dc8dc8c79167674083580e2ebc7b46c39eb8e96b"}}}}
{"actor":{"display_login":"jaylett"}}