comparison src/luan/modules/lucene/Web_search.luan @ 1537:f7649ad6e3e7

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 07 Aug 2020 13:38:25 -0600
parents 34ae786771b6
children c6b50b7b958c
comparison
equal deleted inserted replaced
1536:34ae786771b6 1537:f7649ad6e3e7
225 local doc = Http.request.parameters.doc 225 local doc = Http.request.parameters.doc
226 doc = eval( doc, "lucene", Number ) 226 doc = eval( doc, "lucene", Number )
227 local old = Http.request.parameters.old 227 local old = Http.request.parameters.old
228 old = eval( old, "lucene", Number ) 228 old = eval( old, "lucene", Number )
229 local id = Http.request.parameters.id 229 local id = Http.request.parameters.id
230 local msg = "Lucene Updated"
230 index.run_in_transaction( function() 231 index.run_in_transaction( function()
231 local current = index.get_document("id:"..id) 232 local current = index.get_document("id:"..id)
232 equal(current,old) or error "document has changed" 233 if not equal(current,old) then
234 msg = "ERROR: document has changed"
235 return
236 end
233 if doc == nil then 237 if doc == nil then
234 index.delete("id:"..id) 238 index.delete("id:"..id)
235 else 239 else
236 index.save(doc) 240 index.save(doc)
237 end 241 end
244 <style> 248 <style>
245 <% style() %> 249 <% style() %>
246 </style> 250 </style>
247 </head> 251 </head>
248 <body> 252 <body>
249 <h2>Lucene Updated</h2> 253 <h2><%=msg%></h2>
250 </body> 254 </body>
251 </html> 255 </html>
252 <% 256 <%
253 end 257 end
254 258