Source: site.view [edit]
Function name: stories
Arguments:
Description: Return list of submitted stories. Optional arg can be an ID of a particular story.
Page type: webl
Render function:   storyRender
Module: jw

Page source:

var reader = Wub_ReadLuceneIndex("jwstories");

var docs;
if Size(OPTIONALARGS) > 0 then
   docs = Wub_LuceneSearch(reader, "id", OPTIONALARGS[0], 1);
else
   docs = Wub_LuceneSearch(reader, "true", "1", 500);
end;

var res = [];

var i = 0;
while (i < docs.size()) do
   var d = [. .];
   d["date"] := docs.get(i).getField("date").stringValue();
   d["id"] := docs.get(i).getField("id").stringValue();
   d["name"] := docs.get(i).getField("name").stringValue();
   d["addr"] := docs.get(i).getField("addr").stringValue();
   d["phone"] := docs.get(i).getField("phone").stringValue();
   d["story"] := docs.get(i).getField("story").stringValue();
   res = [d] + res;
   i = i + 1
end;  

res;