Source: site.view [edit]
Function name: cmdSearchByJob
Arguments: title,jobDesc
Description: Searches the resume db for people applicable to a specific Job
Page type: webl
Render function:   skillsrank.searchResults
Module: skillsrank

Page source:

var res = [];


var clean = fun(str)
   str= Wub_ReplaceAll(str, "+", "");
   str= Wub_ReplaceAll(str, "-", "");
   str= Wub_ReplaceAll(str, "&", "");
   str= Wub_ReplaceAll(str, "|", "");
   str= Wub_ReplaceAll(str, "(", "");
   str= Wub_ReplaceAll(str, ")", "");
   str= Wub_ReplaceAll(str, "{", "");
   str= Wub_ReplaceAll(str, "}", "");
   str= Wub_ReplaceAll(str, "^", "");
   str= Wub_ReplaceAll(str, "%", "");
   str= Wub_ReplaceAll(str, "\"", "");
   str= Wub_ReplaceAll(str, "'", "");
   str= Wub_ReplaceAll(str, "*", "");
   str= Wub_ReplaceAll(str, "~", "");
   str= Wub_ReplaceAll(str, ":", "");
   str= Wub_ReplaceAll(str, "\\", "");
   str= Wub_ReplaceAll(str, "?", "");
   str= Wub_ReplaceAll(str, "!", "");
   str= Wub_ReplaceAll(str, ".", "");
   str= Wub_ReplaceAll(str, "•", "");


   return str
end;

   var reader2 = Wub_ReadLuceneIndex("resumes");

   var jobSearch = clean(Str_Trim(title) + Str_Trim(jobDesc) );

   var docs2 = Wub_LuceneSearch(reader2, "skills", jobSearch, 20, "standard");

   Wub_CloseLuceneIndex(reader2);
   var i = 0;
   var sz = (docs2.size() ? 0);

   while (i < sz) do
      var d = [. .];
      d["id"] := docs2.get(i).getField("id").stringValue();
      d["name"] := docs2.get(i).getField("name").stringValue();
      d["site-standard-profile-request"] := docs2.get(i).getField("site-standard-profile-request").stringValue();
      d["picture-url"] := docs2.get(i).getField("picture-url").stringValue();
      d["headline"] := docs2.get(i).getField("headline").stringValue();
      res = res + [d];
      i = i + 1
   end;

[. title = "Relevant for Job", people = res .];