Source: site.view [edit]
Function name: cmdSearchResumes
Arguments: keywords,title,region,salary,education,school
Description: Searches the resume db for specified keywords
Page type: webl
Render function:   searchResults
Module: collabExt

Page source:

var reader = Wub_ReadLuceneIndex("resumes");

var AddAnd = fun(query, constraint)
   if Str_Trim(query) == "" then
      return constraint
   else
      return query + " AND " + constraint
   end
end;

var query = keywords;

if (query == nil) then
   query = ""
end;


if (region!= nil and region!= "" and region != "+") then
   query = AddAnd(query, "location:" + region)
end;

if (title!= nil and title!= "" and title != "+") then
   query = AddAnd(query, "positions:" + title)
end;

if (education != nil and education != "" and education != "+") then
   query = AddAnd(query, "qEduScore:" + education)
end;

if (school != nil and school != "" and school != "+") then
   query = AddAnd(query, "qSchoolScore:" + school)
end;


var res = [];

if query != "" then
   var docs = Wub_LuceneSearch(reader, "skills", query, 50, "standard");

   Wub_CloseLuceneIndex(reader);

   var i = 0;
   while (i < docs.size()) do
      var d = [. .];
      var doc = docs.get(i).getDoc();
      d["id"] := (doc.getField("id").stringValue() ? "?id");
      d["name"] := (doc.getField("name").stringValue() ? "?name");
      d["site-standard-profile-request"] := (doc.getField("site-standard-profile-request").stringValue() ? "?name");
      d["picture-url"] := (doc.getField("picture-url").stringValue() ? "?site-standard-profile-request");
      d["headline"] := (doc.getField("headline").stringValue() ? "?headline");
      d["eduScore"] := (doc.getField("eduScore").stringValue() ? "?eduScore");
      d["degreeScore"] := (doc.getField("eduScore").stringValue() ? "?degreeScore");
      d["schoolScore"] := (doc.getField("schoolScore").stringValue() ? "?schoolScore");
      res = res + [d];
      i = i + 1
   end
else
   query = "Empty query"
end;

[. title="Skill: " + query, people=res .];