Mercurial Hosting > luan
diff src/luan/modules/lucene/LuceneIndex.java @ 1420:225808b90cee
options handling
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 26 Oct 2019 22:21:09 -0600 |
parents | dc625408def8 |
children | 103d0ce70385 |
line wrap: on
line diff
--- a/src/luan/modules/lucene/LuceneIndex.java Fri Oct 25 22:12:06 2019 -0600 +++ b/src/luan/modules/lucene/LuceneIndex.java Sat Oct 26 22:21:09 2019 -0600 @@ -143,14 +143,14 @@ private LuceneIndex(Luan luan,File indexDir,LuanTable options) throws LuanException, IOException, ClassNotFoundException, SQLException { - Map map = options.asMap(); - this.version = map.remove("version"); - FieldParser defaultFieldParser = (FieldParser)map.remove("default_type"); - LuanTable defaultFieldsTbl = Utils.removeTable(map,"default_fields"); + options = new LuanTable(options); + this.version = options.remove("version"); + FieldParser defaultFieldParser = (FieldParser)options.remove("default_type"); + LuanTable defaultFieldsTbl = Utils.removeTable(options,"default_fields"); String[] defaultFields = defaultFieldsTbl==null ? null : (String[])defaultFieldsTbl.asList().toArray(new String[0]); - LuanFunction completer = Utils.removeFunction(map,"completer"); - LuanTable postgresSpec = Utils.removeTable(map,"postgres_spec"); - Utils.checkEmpty(map); + LuanFunction completer = Utils.removeFunction(options,"completer"); + LuanTable postgresSpec = Utils.removeTable(options,"postgres_spec"); + Utils.checkEmpty(options); this.luanLogger = luan.getLogger(LuceneIndex.class); this.defaultFieldParser = defaultFieldParser; @@ -171,8 +171,7 @@ } else { if( completer == null ) throw new LuanException("completer is required for postgres_spec"); - Map spec = postgresSpec.asMap(); - postgresBackup = new PostgresBackup(luan,spec); + postgresBackup = new PostgresBackup(luan,postgresSpec); if( !wasCreated && postgresBackup.wasCreated ) { luanLogger.error("rebuilding postgres backup"); rebuild_postgres_backup(completer);