Esempio n. 1
0
def _filter_for_base_path(base_result, query):
    res = QueryResult()
    res.debug_info = copy.deepcopy(base_result.debug_info)
    res.truncated = base_result.truncated

    for hit,rank in base_result.hits:
      if _is_in_base_path(hit, query.base_path):
        res.filenames.append(hit)
        res.ranks.append(rank)
    return res
Esempio n. 2
0
def _filter_result_for_exact_matches(query_text, base_result):
  """
  Returns a new QueryResult object containing only filenames that exactly
  match the provided query.
  """
  res = QueryResult()
  res.debug_info = copy.deepcopy(base_result.debug_info)
  res.truncated = base_result.truncated

  for hit,rank in base_result.hits:
    if _is_exact_match(query_text, hit):
      res.filenames.append(hit)
      res.ranks.append(rank)
  return res