Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/LuceneWriter.java @ 426:23a93c118042
fix LuanTable.get() to use metatables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 May 2015 18:44:20 -0600 |
parents | 23b99a5039b5 |
children | dae264ad6a7b |
comparison
equal
deleted
inserted
replaced
425:0a2fb80907f9 | 426:23a93c118042 |
---|---|
56 String nextId(LuanState luan) throws LuanException, IOException { | 56 String nextId(LuanState luan) throws LuanException, IOException { |
57 return index.nextId(luan); | 57 return index.nextId(luan); |
58 } | 58 } |
59 | 59 |
60 public void save_document(LuanState luan,LuanTable doc) throws LuanException, IOException { | 60 public void save_document(LuanState luan,LuanTable doc) throws LuanException, IOException { |
61 if( doc.get("type")==null ) | 61 if( doc.get(luan,"type")==null ) |
62 throw luan.exception("missing 'type' field"); | 62 throw luan.exception("missing 'type' field"); |
63 String id = (String)doc.get("id"); | 63 String id = (String)doc.get(luan,"id"); |
64 if( id == null ) { | 64 if( id == null ) { |
65 id = nextId(luan); | 65 id = nextId(luan); |
66 doc.put("id",id); | 66 doc.put("id",id); |
67 addDocument(luan,doc); | 67 addDocument(luan,doc); |
68 } else { | 68 } else { |