Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
1686:e34b73678a4f | 1687:f48db13ae2d9 |
---|---|
305 wrote(); | 305 wrote(); |
306 writeLock.unlock(); | 306 writeLock.unlock(); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 public void save(Luan luan,LuanTable doc) | 310 public void save( Luan luan, LuanTable doc, LuanTable unstored, Map<String,Float> boosts ) |
311 throws LuanException, IOException, SQLException | 311 throws LuanException, IOException, SQLException |
312 { | 312 { |
313 Object obj = doc.get(luan,"id"); | 313 Object obj = doc.get(luan,"id"); |
314 Long id; | 314 Long id; |
315 try { | 315 try { |
319 } | 319 } |
320 | 320 |
321 boolean commit = !writeLock.isHeldByCurrentThread(); | 321 boolean commit = !writeLock.isHeldByCurrentThread(); |
322 writeLock.lock(); | 322 writeLock.lock(); |
323 try { | 323 try { |
324 if( id == null ) { | 324 if( unstored!=null || boosts!=null ) { |
325 if( unstored == null ) | |
326 throw new LuanException("unstored required with boosts"); | |
327 if( boosts == null ) | |
328 throw new LuanException("boosts required with unstored"); | |
329 if( id != null ) | |
330 throw new LuanException("update not supported"); | |
331 if( postgresBackup != null ) | |
332 throw new LuanException("not supported with postgres backup"); | |
333 if( !(writer instanceof LuceneIndexWriter) ) | |
334 throw new LuanException("not supported with index logging"); | |
335 id = ++this.id; | |
336 doc.put(luan,"id",id); | |
337 LuceneIndexWriter liw = (LuceneIndexWriter)writer; | |
338 liw.addDocument( toLucene(doc), toLucene(unstored), boosts ); | |
339 } else if( id == null ) { | |
325 id = ++this.id; | 340 id = ++this.id; |
326 doc.put(luan,"id",id); | 341 doc.put(luan,"id",id); |
327 if( postgresBackup != null ) | 342 if( postgresBackup != null ) |
328 postgresBackup.add(luan,doc); | 343 postgresBackup.add(luan,doc); |
329 writer.addDocument(toLucene(doc)); | 344 writer.addDocument(toLucene(doc)); |