def getMatches(query): username_match_ids = [] name_match_ids = [] # This is required since we are not pushing data to trinity until we have a resume # TODO: Push Name + Social Details as plain text, even if there is no resume. # This is also required for better RELEVANCE if not re.match("((^.*[\s]+(and|not)[\s]+.*$)|(^.*?[\(\)]+.*$))", query, re.IGNORECASE): keyword_list = re.compile("[,\s]+").split(query) username_matches = models.User.objects.filter( account__username=keyword_list[0], account__account_state="A" ).values("id") name_matches = models.User.objects.filter(name__icontains=keyword_list[0], account__account_state="A").values( "id" ) username_match_ids = [dict.values()[0] for dict in username_matches] name_match_ids = [dict.values()[0] for dict in name_matches] # limit name matches to 5 name_match_ids = name_match_ids[:5] # resume-search on TRINITY resume_match_ids = [] query = replaceSpecialKeyWords(query) data = trinity_client.getQueryResults( "resume_search", "filecontents:(" + query + ')<queryParams><sort field="last_access_time" order="DESC" /></queryParams>', ) if data: fts_reply = data.split(",") resume_match_ids = map(lambda s: string.atoi(s), fts_reply) return dataplus.getMergedList(username_match_ids, name_match_ids, resume_match_ids)[:200]
def getMatches(keywords): #job-search jobids = [] data = trinity_client.getQueryResults('job_search', 'filecontents:(' + keywords + ')<queryParams><sort field="last_updated_on" order="DESC" /></queryParams>') if data: js_reply = data.split(',') jobids += map(lambda s:string.atoi(s), js_reply) return jobids
def getMatchesEx(query): # resume-search on TRINITY resume_match_ids = [] query = replaceSpecialKeyWords(query) data = trinity_client.getQueryResults( "resume_search", query + '<queryParams><sort field="resume_update_time" order="DESC" /></queryParams>' ) if data: fts_reply = data.split(",") resume_match_ids = map(lambda s: string.atoi(s), fts_reply) return resume_match_ids