Mercurial Hosting > luan
diff src/luan/modules/lucene/LuceneIndex.java @ 1687:f48db13ae2d9
unlogged lucene support
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 09 Jun 2022 19:44:41 -0600 |
parents | 46cf5137cb6b |
children | 973d3039c421 |
line wrap: on
line diff
--- a/src/luan/modules/lucene/LuceneIndex.java Wed Jun 08 21:55:25 2022 -0600 +++ b/src/luan/modules/lucene/LuceneIndex.java Thu Jun 09 19:44:41 2022 -0600 @@ -307,7 +307,7 @@ } } - public void save(Luan luan,LuanTable doc) + public void save( Luan luan, LuanTable doc, LuanTable unstored, Map<String,Float> boosts ) throws LuanException, IOException, SQLException { Object obj = doc.get(luan,"id"); @@ -321,7 +321,22 @@ boolean commit = !writeLock.isHeldByCurrentThread(); writeLock.lock(); try { - if( id == null ) { + if( unstored!=null || boosts!=null ) { + if( unstored == null ) + throw new LuanException("unstored required with boosts"); + if( boosts == null ) + throw new LuanException("boosts required with unstored"); + if( id != null ) + throw new LuanException("update not supported"); + if( postgresBackup != null ) + throw new LuanException("not supported with postgres backup"); + if( !(writer instanceof LuceneIndexWriter) ) + throw new LuanException("not supported with index logging"); + id = ++this.id; + doc.put(luan,"id",id); + LuceneIndexWriter liw = (LuceneIndexWriter)writer; + liw.addDocument( toLucene(doc), toLucene(unstored), boosts ); + } else if( id == null ) { id = ++this.id; doc.put(luan,"id",id); if( postgresBackup != null )