后端程序员之路 35、Index搜索引擎实现分析4-最终的正排索引与倒排索引
# index_box 提供搜索功能的实现
- 持有std::vector<ITEM> _buffer; 存储所有文章信息
- 持有ForwardIndex _forward_index;
- _forward_index.build_findex( _buffer )
- get_all_items _forward_index.get_all_items
- get_items _forward_index.get_items(docid_vect, result, filters);
- get_item _forward_index.get_item
- 持有InvertedIndex _inverted_index;
- _inverted_index.build_iindex( _forward_index.get_forword_index() );
- search _inverted_index.trigger(docid_result, working_vect, docid_set, user_profile, search_params);
# ForwardIndex 正排索引(正向索引)
- 持有boost::unordered_map<uint64_t, ITEM> _id2docitem
- 持有boost::unordered_map<uint64_t, filter_t> _id2filter;
- 持有boost::unordered_map<uint64_t, bool> _blacklist;
- build_findex
- 已删除的文章从_id2docitem、_id2filter删除,加入到_blacklist
- 更新黑名单,把已更新的文章从_blacklist删除
- 已过期文章加入_blacklist,从_id2docitem、_id2filter删除
- 加入新文章或者更新后的文章到_id2docitem、_id2filter
- get_all_items 返回_id2docitem的数据
- get_item 返回_id2docitem.find
- get_items 处理filters,然后_id2docitem.find
- filter_ids 根据FilterJudge和search_params_t对文章进行过滤
# InvertedIndex 倒排索引(反向索引)
- boost::unordered_map<uint64_t, docid_vect_t > inverted_index_t; 从key到文章数组的映射
- std::vector<inverted_index_t> multi_inverted_index_t; 多个从key到文章数组的映射
- 内置
- build_iindex
- 建立category、keyword、topic、ventity等到docid的索引
- 对数据的vector根据打分进行排序
- trigger
- 构造working_vect,用于整个流程放置文章集
- 进行一系列的trigger_by_features
- 从一系列特征找到一系列文章vect
- 找到的文章进行union_insert,合并到working_vect
- 进行一系列的trigger_or_keys
- 基本同trigger_by_features
- 对working_vect里的文章进行check_intersection,即匹配更多and/no操作,得到最终docid_vect
后端程序员之路 35、Index搜索引擎实现分析4-最终的正排索引与倒排索引的更多相关文章
- 后端程序员之路 32、Index搜索引擎实现分析1-类的设计
# 1.forward_index 正排索引(正向索引)- filter_t- filter_judge # 2.inverted_index 倒排索引(反向索引)- inverted_pre_sco ...
- 后端程序员之路 33、Index搜索引擎实现分析2-对外接口和大体流程
# index_manager的单例是index server对外的唯一接口,part_indexer是index搜索的核心部分,index_manager持有了一组part_indexer. typ ...
- 后端程序员之路 34、Index搜索引擎实现分析3-对文章索引的两层分块
# part_indexer 对文章根据id的hash进行分块索引- 持有 search_index _inc_index[2]; search_index _history_index[2]; 进行 ...
- 后端程序员之路 43、Redis list
Redis数据类型之LIST类型 - Web程序猿 - 博客频道 - CSDN.NEThttp://blog.csdn.net/thinkercode/article/details/46565051 ...
- 后端程序员之路 13、使用KNN进行数字识别
尝试一些用KNN来做数字识别,测试数据来自:MNIST handwritten digit database, Yann LeCun, Corinna Cortes and Chris Burgesh ...
- 后端程序员之路 59、go uiprogress
gosuri/uiprogress: A go library to render progress bars in terminal applicationshttps://github.com/g ...
- 后端程序员之路 31、Protocol Buffer
google/protobuf: Protocol Buffers - Google's data interchange formathttps://github.com/google/protob ...
- 后端程序员之路 22、RESTful API
理解RESTful架构 - 阮一峰的网络日志http://www.ruanyifeng.com/blog/2011/09/restful.html RESTful API 设计指南 - 阮一峰的网络日 ...
- 后端程序员之路 16、信息熵 、决策树、ID3
信息论的熵 - guisu,程序人生. 逆水行舟,不进则退. - 博客频道 - CSDN.NEThttp://blog.csdn.net/hguisu/article/details/27305435 ...
随机推荐
- c++格式化输入输出以及操纵器的使用
C++格式化输入和输出 1,ios类中定义的格式控制标志 ios类中定义了一个数据成员:格式控制标志字,long x_flags x_flags每一位的状态值用枚举符号常量定义:如下列出常用几个 en ...
- hdu 2072 单词数(字符串)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2072 题意 每行输入由小写字母和空格组成,统计每行中不同的单词数. 题解 题解一 比较简洁的解法,读入 ...
- 2019牛客多校 Round1
Solved:4 Rank:143 A Equivalent Prefixes 题意:求一个最大的r满足在A,B两个数组中1,r里所有的子区间RMQ相等 题解:单调队列秒 #include <b ...
- Educational Codeforces Round 88 (Rated for Div. 2) D. Yet Another Yet Another Task(枚举/最大连续子序列)
题目链接:https://codeforces.com/contest/1359/problem/D 题意 有一个大小为 $n$ 的数组,可以选取一段连续区间去掉其中的最大值求和,问求和的最大值为多少 ...
- codeforces #345 (Div. 1) D. Zip-line (线段树+最长上升子序列)
Vasya has decided to build a zip-line on trees of a nearby forest. He wants the line to be as long a ...
- Codeforces Round #692 (Div. 2, based on Technocup 2021 Elimination Round 3) C. Peaceful Rooks (思维,dsu找环)
题意:一个棋盘上有一些"车",现在要让这些"车"跑到左倾斜的对角线上,每次可以移动一个棋子,但是棋盘的任意时刻都不能出现一个"车"能吃另一个 ...
- C#异步和多线程以及Thread、ThreadPool、Task区别和使用方法
本文的目的是为了让大家了解什么是异步?什么是多线程?如何实现多线程?对于当前C#当中三种实现多线程的方法如何实现和使用?什么情景下选用哪一技术更好? 第一部分主要介绍在C#中异步(async/awai ...
- Jenkins+ant+Jmeter接口自动化框架搭建
工具准备 JDK: jdk1.8.0_111 Ant: apache-ant-1.9.9 Jmeter: apache-jmeter-3.1 Jenkins: jenkins-2.7.4 JDK安装 ...
- HDU - 4462 Scaring the Birds
It's harvest season now! Farmer John plants a lot of corn. There are many birds living around his co ...
- 痞子衡嵌入式:超级下载算法(RT-UFL)开发笔记(4) - 轮询Flash配置参数
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是超级下载算法开发笔记(4)之轮询Flash配置参数. 文接上篇 <超级下载算法(RT-UFL)开发笔记(3) - 统一FlexSP ...