Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: similarPerson Arguments: personId Description: Searches the resume db for people with similar skills to the specified person Page type: webl Render function: skillsrank.searchResults Module: skillsrank Page source: var reader = Wub_ReadLuceneIndex("resumes"); var docs = Wub_LuceneSearch(reader, "id", personId, 1, "standard"); Wub_CloseLuceneIndex(reader); var res = []; var name = "Unknown"; if (docs.size() == 1) then var doc = docs.get(0).getDoc(); var skills = doc.getField("skills").stringValue(); name = doc.getField("name").stringValue(); skills = Wub_ReplaceAll(skills, "[", ""); skills = Wub_ReplaceAll(skills, "]", ""); skills = Wub_ReplaceAll(skills, ".", ""); skills = Wub_ReplaceAll(skills, "=", ""); skills = Wub_ReplaceAll(skills, ",", ""); skills = Wub_ReplaceAll(skills, `"`, ""); skills = Wub_ReplaceAll(skills, `:`, ""); skills = Wub_ReplaceAll(skills, `@`, ""); skills = Select(skills, 0, 255); var reader2 = Wub_ReadLuceneIndex("resumes"); var docs2 = Wub_LuceneSearch(reader2, "skills", skills, 20, "standard"); Wub_CloseLuceneIndex(reader2); var i = 0; var sz = (docs2.size() ? 0); while (i < sz) do var doc = docs2.get(i).getDoc(); var d = [. .]; d["id"] := doc.getField("id").stringValue(); d["name"] := doc.getField("name").stringValue(); d["site-standard-profile-request"] := doc.getField("site-standard-profile-request").stringValue(); d["picture-url"] := doc.getField("picture-url").stringValue(); d["headline"] := doc.getField("headline").stringValue(); res = res + [d]; i = i + 1 end end; [. title = "Similar to: " + name, people = res .];