Mercurial Hosting > luan
comparison src/luan/modules/lucene/Lucene.luan @ 796:6b8ea0a9b7c9
remove LuanMeta
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 05 Sep 2016 19:52:49 -0600 |
parents | 1a68fc55a80c |
children | bae2d0c2576c |
comparison
equal
deleted
inserted
replaced
795:dd36eae6aa04 | 796:6b8ea0a9b7c9 |
---|---|
1 java() | 1 java() |
2 local Luan = require "luan:Luan.luan" | 2 local Luan = require "luan:Luan.luan" |
3 local error = Luan.error | 3 local error = Luan.error |
4 local ipairs = Luan.ipairs or error() | 4 local ipairs = Luan.ipairs or error() |
5 local type = Luan.type or error() | 5 local type = Luan.type or error() |
6 local set_metatable = Luan.set_metatable or error() | |
6 local Html = require "luan:Html.luan" | 7 local Html = require "luan:Html.luan" |
7 local Io = require "luan:Io.luan" | 8 local Io = require "luan:Io.luan" |
8 local uri = Io.uri or error() | 9 local uri = Io.uri or error() |
9 local String = require "luan:String.luan" | 10 local String = require "luan:String.luan" |
10 local matches = String.matches or error() | 11 local matches = String.matches or error() |
34 | 35 |
35 function M.index(index_dir,default_type,default_fields) | 36 function M.index(index_dir,default_type,default_fields) |
36 local index = {} | 37 local index = {} |
37 index.dir = index_dir | 38 index.dir = index_dir |
38 local java_index = LuceneIndex.new(index_dir,default_type,default_fields) | 39 local java_index = LuceneIndex.new(index_dir,default_type,default_fields) |
39 index.indexed_fields = java_index.indexedFieldsMeta.newTable() | 40 -- index.indexed_fields = java_index.indexedFieldsMeta.newTable() |
41 | |
42 index.indexed_fields = {} | |
43 local mt = {} | |
44 set_metatable(index.indexed_fields,mt) | |
45 function mt.__index(_,key) | |
46 return java_index.getIndexedFieldParser(key) | |
47 end | |
48 function mt.__new_index(_,key,value) | |
49 return java_index.setIndexedFieldParser(key,value) | |
50 end | |
40 | 51 |
41 -- index.indexed_only_fields[type][field] = fn(doc) | 52 -- index.indexed_only_fields[type][field] = fn(doc) |
42 index.indexed_only_fields = java_index.indexed_only_fields | 53 index.indexed_only_fields = java_index.indexed_only_fields |
43 | 54 |
44 index.to_string = java_index.to_string | 55 index.to_string = java_index.to_string |