Permalink
Browse files

wip: couchdb port

  • Loading branch information...
1 parent b0fc629 commit c394f8b7b836ecc1618f784e38db1ebad9cd93aa @comotion committed Feb 7, 2013
Showing with 44 additions and 15 deletions.
  1. +2 −0 setup.sh
  2. +22 −1 web/doc/searches.txt
  3. +1 −1 web/lib/lamt
  4. +13 −0 web/lib/tokyo.lua
  5. +6 −13 web/lib/tracks.lua
View
@@ -64,6 +64,8 @@ case $os in
esac
esac
+# arch is using some broken cvs shit
+luarocks install wsapi 1.5-1
for module in orbit lua-cjson lua-iconv luacrypto struct
do
luarocks install $module
View
@@ -45,6 +45,27 @@ search for
-- post-filter the search to remove entries that don't include all tokens
we have opted for just doing metasearches at the cost of less intuitive searches
-
for now.
+Problem is general. shit is real.
+
+approach theta:
+get all keys, search in these
+
+approach chi:
+get all key=value pairs, search in these = "uniview"
+
+approach zeta:
+lucene, or solr, fulltext it.
+
+approach tau:
+stick to a predefined set of views.
+
+approach rho:
+use riak-search. why this not better than solr?
+
+approach ksi:
+generate views(indexes) on-the-fly if they dont exist
+..you add an unindexed tag, we make a view on that tag..
+
+
Submodule lamt updated from 6a2772 to 1c6f6e
View
@@ -93,5 +93,18 @@ function tokyo_booter()
return db
end
+function tokyo:dump()
+ trk:iterinit()
+ local key, value, accu
+ accu = {}
+ while true do
+ key = trk:iternext()
+ if not key then break end
+ value = trk:get(key)
+ table.insert(accu,value)
+ end
+ return accu
+end
+
return tokyo
View
@@ -20,15 +20,17 @@
-- count total results (or pages)
require "os"
-local db = require "lib/tokyo"
+local db = require "couch"
local u = require "lib/util"
module("tracks", package.seeall)
+local database = "tracks"
function tracks:init()
- return db:init("tracks")
+ return db:init(database)
end
+-- local instance of the db connection saves us an init call
local trk = tracks:init()
function tracks:put(pkey,cols)
@@ -39,7 +41,7 @@ end
-- returns: trackid,entry,error
function tracks:add(cols)
local cols = cols or {}
- local pkey = trk:genuid()
+ local pkey = db:genuid()
cols.added = os.time()
cols.station = cols.station or default_station
print("adding ".. u.dump(cols))
@@ -149,16 +151,7 @@ function tracks:gsearch(q, qf, order)
end
function tracks:dump()
- trk:iterinit()
- local key, value, accu
- accu = {}
- while true do
- key = trk:iternext()
- if not key then break end
- value = trk:get(key)
- table.insert(accu,value)
- end
- return u.dump(accu)
+ return u.dump(db:dump())
end
function tracks:get(pkey)

0 comments on commit c394f8b

Please sign in to comment.