Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/LuceneWriter.java @ 427:dae264ad6a7b
fix LuanTable.put() to use metatables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 May 2015 19:29:07 -0600 |
parents | 23a93c118042 |
children | d9df6d6cb927 |
comparison
equal
deleted
inserted
replaced
426:23a93c118042 | 427:dae264ad6a7b |
---|---|
61 if( doc.get(luan,"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(luan,"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(luan,"id",id); |
67 addDocument(luan,doc); | 67 addDocument(luan,doc); |
68 } else { | 68 } else { |
69 updateDocument(luan,index.newTerm("id",id),doc); | 69 updateDocument(luan,index.newTerm("id",id),doc); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 // luan | 73 // luan |
74 | 74 |
75 private void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException { | 75 private void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException { |
76 t.put( method, new LuanJavaFunction(LuceneWriter.class.getMethod(method,parameterTypes),this) ); | 76 t.rawPut( method, new LuanJavaFunction(LuceneWriter.class.getMethod(method,parameterTypes),this) ); |
77 } | 77 } |
78 | 78 |
79 LuanTable table() { | 79 LuanTable table() { |
80 LuanTable tbl = new LuanTable(); | 80 LuanTable tbl = new LuanTable(); |
81 try { | 81 try { |