Mercurial Hosting > luan
diff lucene/src/luan/modules/lucene/Ab_testing.luan @ 544:c5a93767cc5c
lucene overhaul, untested
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 12 Jun 2015 19:11:44 -0600 |
parents | 473e456444ff |
children | ddcd4296107a |
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/Ab_testing.luan Mon Jun 08 01:11:08 2015 -0400 +++ b/lucene/src/luan/modules/lucene/Ab_testing.luan Fri Jun 12 19:11:44 2015 -0600 @@ -10,6 +10,7 @@ local Io = require "luan:Io" local Http = require "luan:http/Http" local Logging = require "luan:logging/Logging" +local Lucene = require "luan:lucene/Lucene" local M = {} @@ -34,8 +35,8 @@ -- test.date_field is optional local field = "ab_test_" .. test.name - index.fields[field] == nil or error("test "+test.name+" already defined") - index.fields[field] = field .. " index" + index.indexed_fields[field] == nil or error("test "+test.name+" already defined") + index.indexed_fields[field] = Lucene.type.string test.field = field -- returns map of event name to (map of value to result) and "start_date" @@ -52,7 +53,7 @@ for name, factory in pairs(test.aggregator_factories) do aggregators[name] = factory() end - local query = index.query.term{ [field] = value } + local query = field..":"..value searcher.search(query, function(doc) for _, aggregator in pairs(aggregators) do aggregator.aggregate(doc)