def load_gitsearch_items(self, github_items):
        matched_term_acc = set()
        for github_item in github_items:
            gitsearch_item = GitSearchItem(github_item)
            gitsearch_item_hash = md5(str(gitsearch_item.file_path))

            if gitsearch_item_hash not in self.hashes:
                self.items.append(gitsearch_item)
                self.hashes.add(gitsearch_item_hash)
                matched_term_acc = matched_term_acc.union(
                    gitsearch_item.matched_terms)
        self.global_matched_terms = list(matched_term_acc)
    def load_gitsearch_items(self, github_items, search_count, targetpath):
        matched_term_acc = set()
        # global rank

        #여기서 github_items 정렬 다시해보자..
        github_items = sorted(github_items,
                              key=attrgetter('score'),
                              reverse=True)
        rank = 0
        for github_item in github_items:
            rank += 1
            gitsearch_item = GitSearchItem(github_item, search_count, rank,
                                           targetpath)
            gitsearch_item_hash = md5(str(gitsearch_item.file_path))

            if gitsearch_item_hash not in self.hashes:
                self.items.append(gitsearch_item)
                self.hashes.add(gitsearch_item_hash)
                matched_term_acc = matched_term_acc.union(
                    gitsearch_item.matched_terms)
        self.global_matched_terms = list(matched_term_acc)
Exemple #3
0
def render_code_results(query):
    github_items = query_index(query)
    git_search_items = [
        GitSearchItem(github_item) for github_item in github_items
    ]
    return git_search_items