Mercurial Hosting > luan
diff lucene/src/luan/modules/lucene/LuceneIndex.java @ 578:60c549d43988
remove LuanState.exception()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 14 Jul 2015 17:40:48 -0600 |
parents | 7c3ad6db8ac3 |
children | 790d5de23042 |
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/LuceneIndex.java Mon Jul 13 20:53:02 2015 -0600 +++ b/lucene/src/luan/modules/lucene/LuceneIndex.java Tue Jul 14 17:40:48 2015 -0600 @@ -135,7 +135,7 @@ public void save(LuanState luan,LuanTable doc) throws LuanException, IOException { if( doc.get(luan,"type")==null ) - throw luan.exception("missing 'type' field"); + throw new LuanException(luan,"missing 'type' field"); Long id = (Long)doc.get(luan,"id"); boolean commit = !writeLock.isHeldByCurrentThread(); @@ -212,7 +212,7 @@ public void backup(LuanState luan,String zipFile) throws LuanException, IOException { if( !zipFile.endsWith(".zip") ) - throw luan.exception("file "+zipFile+" doesn't end with '.zip'"); + throw new LuanException(luan,"file "+zipFile+" doesn't end with '.zip'"); IndexCommit ic = snapshotDeletionPolicy.snapshot(); try { ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile)); @@ -265,7 +265,7 @@ try { return toTable(luan,searcher.doc(docID)); } catch(IOException e) { - throw luan.exception(e); + throw new LuanException(luan,e); } } } @@ -309,7 +309,7 @@ try { if( fn!=null && n==null ) { if( sortStr != null ) - throw luan.exception("sort must be nil when n is nil"); + throw new LuanException(luan,"sort must be nil when n is nil"); final DocFn docFn = new DocFn(searcher); MyCollector col = new MyCollector() { @Override public void collect(int doc) { @@ -350,7 +350,7 @@ public Object search_in_transaction(LuanState luan,LuanFunction fn) throws LuanException, IOException { if( threadLocalSearcher.get() != null ) - throw luan.exception("can't nest search_in_transaction calls"); + throw new LuanException(luan,"can't nest search_in_transaction calls"); IndexSearcher searcher = openSearcher(); threadLocalSearcher.set(searcher); try { @@ -375,14 +375,14 @@ @Override public void __new_index(LuanState luan,LuanTable tbl,Object key,Object value) throws LuanException { if( !(key instanceof String) ) - throw luan.exception("key must be string"); + throw new LuanException(luan,"key must be string"); String field = (String)key; if( value==null ) { // delete mfp.fields.remove(field); return; } if( !(value instanceof FieldParser) ) - throw luan.exception("value must be FieldParser like the values of Lucene.type"); + throw new LuanException(luan,"value must be FieldParser like the values of Lucene.type"); FieldParser parser = (FieldParser)value; mfp.fields.put( field, parser ); } @@ -406,7 +406,7 @@ for( Map.Entry<Object,Object> entry : table.iterable(luan) ) { Object key = entry.getKey(); if( !(key instanceof String) ) - throw luan.exception("key must be string"); + throw new LuanException(luan,"key must be string"); String name = (String)key; Object value = entry.getValue(); if( value instanceof String ) { @@ -441,7 +441,7 @@ byte[] b = (byte[])value; doc.add(new StoredField(name, b)); } else - throw luan.exception("invalid value type "+value.getClass()+"' for '"+name+"'"); + throw new LuanException(luan,"invalid value type "+value.getClass()+"' for '"+name+"'"); } return doc; } @@ -467,7 +467,7 @@ table.rawPut(name,s); continue; } - throw luan.exception("invalid field type for "+ifld); + throw new LuanException(luan,"invalid field type for "+ifld); } return table; }