Source: site.view [edit]
Function name: addStory
Arguments: name,addr,phone,story
Description: Save contact story
Page type: webl
Render function:  
Module: jw

Page source:

var writer = Wub_NewLuceneIndex("jwstories", false);

var doc = Wub_NewLuceneDocument();

var ok = true;

var id = ToString(Wub_GetDateTime());  // date/time as long

ok = ok and Wub_AddLuceneField(doc, "true", "1", true, true);
ok = ok and Wub_AddLuceneField(doc, "id", id, true, true);
ok = ok and Wub_AddLuceneField(doc, "name", name, true, true);
ok = ok and Wub_AddLuceneField(doc, "addr", addr, true, true);
ok = ok and Wub_AddLuceneField(doc, "phone", phone, true, true);
ok = ok and Wub_AddLuceneField(doc, "story", story, true, true);
ok = ok and Wub_AddLuceneField(doc, "date", Wub_GetDateTimeStr(), true, true);

ok = ok and Wub_AddLuceneDocument(writer, doc);

ok = ok and Wub_OptimizeLucene(writer);

ok = ok and Wub_CloseLuceneIndex(writer);

if ok then
   WubCall("jw.contact", ["Thanks for telling me your story!"]);
else
   WubCall("jw.contact", ["Error adding story."]);
end;