comparison src/luan/modules/lucene/Lucene.luan @ 1716:b82767112d8e

add String.regex
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 24 Jul 2022 23:43:03 -0600
parents 2958cf04d844
children f8950d99f47d
comparison
equal deleted inserted replaced
1715:ad44e849c60c 1716:b82767112d8e
13 local integer = Number.integer or error() 13 local integer = Number.integer or error()
14 local Time = require "luan:Time.luan" 14 local Time = require "luan:Time.luan"
15 local Io = require "luan:Io.luan" 15 local Io = require "luan:Io.luan"
16 local uri = Io.uri or error() 16 local uri = Io.uri or error()
17 local String = require "luan:String.luan" 17 local String = require "luan:String.luan"
18 local matches = String.matches or error() 18 local starts_with = String.starts_with or error()
19 local Rpc = require "luan:Rpc.luan" 19 local Rpc = require "luan:Rpc.luan"
20 local LuceneIndex = require "java:luan.modules.lucene.LuceneIndex" 20 local LuceneIndex = require "java:luan.modules.lucene.LuceneIndex"
21 local NumberFieldParser = require "java:goodjava.lucene.queryparser.NumberFieldParser" 21 local NumberFieldParser = require "java:goodjava.lucene.queryparser.NumberFieldParser"
22 local GoodQueryParser = require "java:goodjava.lucene.queryparser.GoodQueryParser" 22 local GoodQueryParser = require "java:goodjava.lucene.queryparser.GoodQueryParser"
23 local Logging = require "luan:logging/Logging.luan" 23 local Logging = require "luan:logging/Logging.luan"
62 Lucene.quote = GoodQueryParser.quote 62 Lucene.quote = GoodQueryParser.quote
63 Lucene.escape = GoodQueryParser.escape 63 Lucene.escape = GoodQueryParser.escape
64 64
65 local function get_file(f) 65 local function get_file(f)
66 type(f)=="table" or error "index_dir must be table" 66 type(f)=="table" or error "index_dir must be table"
67 f.to_uri_string and matches(f.to_uri_string(),"^file:") or error "index_dir must be file" 67 f.to_uri_string and starts_with(f.to_uri_string(),"file:") or error "index_dir must be file"
68 return f.java.file or error() 68 return f.java.file or error()
69 end 69 end
70 70
71 function Lucene.index(index_dir,options) 71 function Lucene.index(index_dir,options)
72 options = options or {} 72 options = options or {}