# HG changeset patch # User Atul Varma # Date 1239660897 25200 # Node ID 58ef69894c96f8aa0a09a039dd9b437a261a446b # Parent 9414e2a40ed33f8075eda0ec73f72146f2c1e627 Results now display on big test, and more status/config info. diff -r 9414e2a40ed3 -r 58ef69894c96 big.html --- a/big.html Mon Apr 13 14:56:57 2009 -0700 +++ b/big.html Mon Apr 13 15:14:57 2009 -0700 @@ -11,8 +11,12 @@

Browser Big Couch Test

+
+
+
+
diff -r 9414e2a40ed3 -r 58ef69894c96 big.js --- a/big.js Mon Apr 13 14:56:57 2009 -0700 +++ b/big.js Mon Apr 13 15:14:57 2009 -0700 @@ -56,39 +56,54 @@ db.put(docs, cb); } -BrowserCouch.get( - "big", - function(db) { - var status = document.getElementById("status"); - if (db.getLength() == 0) { - status.textContent = "Building new corpus."; - db.wipe(function() { makeCorpus(db, run); }); - } else - run(); +var config = document.getElementById("config"); +var status = document.getElementById("status"); +var result = document.getElementById("result"); + +status.textContent = "Please wait..."; +config.textContent = ("Counting word occurrences in a lexicon of " + + LEXICON_SIZE + " words, using a corpus of " + + CORPUS_SIZE + " documents, each of which is " + + MIN_DOCUMENT_LENGTH + " to " + MAX_DOCUMENT_LENGTH + + " words long."); + +function start() { + BrowserCouch.get( + "big", + function(db) { + if (db.getLength() == 0) { + status.textContent = "Building new corpus."; + db.wipe(function() { makeCorpus(db, run); }); + } else + run(); - function run() { - db.view( - {map: function(doc, emit) { - var words = doc.content.split(" "); - for (var i = 0; i < words.length; i++) - emit(words[i], 1); - }, - reduce: function(keys, values) { - var sum = 0; - for (var i = 0; i < values.length; i++) - sum += values[i]; - return sum; - }, - chunkSize: 5, - progress: function(phase, percent, resume) { - percent = Math.floor(percent * 100); - var msg = phase + " (" + percent + "%)"; - status.textContent = msg; - window.setTimeout(resume, 5); - }, - finished: function(result) { - status.textContent = "Done."; - }} - ); - } - }); + function run() { + db.view( + {map: function(doc, emit) { + var words = doc.content.split(" "); + for (var i = 0; i < words.length; i++) + emit(words[i], 1); + }, + reduce: function(keys, values) { + var sum = 0; + for (var i = 0; i < values.length; i++) + sum += values[i]; + return sum; + }, + chunkSize: 5, + progress: function(phase, percent, resume) { + percent = Math.floor(percent * 100); + var msg = phase + " (" + percent + "%)"; + status.textContent = msg; + window.setTimeout(resume, 5); + }, + finished: function(aResult) { + status.textContent = "Done."; + result.textContent = JSON.stringify(aResult); + }} + ); + } + }); +} + +window.addEventListener("load", start, false);