# 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-最终的正排索引与倒排索引的更多相关文章

  1. 后端程序员之路 32、Index搜索引擎实现分析1-类的设计

    # 1.forward_index 正排索引(正向索引)- filter_t- filter_judge # 2.inverted_index 倒排索引(反向索引)- inverted_pre_sco ...

  2. 后端程序员之路 33、Index搜索引擎实现分析2-对外接口和大体流程

    # index_manager的单例是index server对外的唯一接口,part_indexer是index搜索的核心部分,index_manager持有了一组part_indexer. typ ...

  3. 后端程序员之路 34、Index搜索引擎实现分析3-对文章索引的两层分块

    # part_indexer 对文章根据id的hash进行分块索引- 持有 search_index _inc_index[2]; search_index _history_index[2]; 进行 ...

  4. 后端程序员之路 43、Redis list

    Redis数据类型之LIST类型 - Web程序猿 - 博客频道 - CSDN.NEThttp://blog.csdn.net/thinkercode/article/details/46565051 ...

  5. 后端程序员之路 13、使用KNN进行数字识别

    尝试一些用KNN来做数字识别,测试数据来自:MNIST handwritten digit database, Yann LeCun, Corinna Cortes and Chris Burgesh ...

  6. 后端程序员之路 59、go uiprogress

    gosuri/uiprogress: A go library to render progress bars in terminal applicationshttps://github.com/g ...

  7. 后端程序员之路 31、Protocol Buffer

    google/protobuf: Protocol Buffers - Google's data interchange formathttps://github.com/google/protob ...

  8. 后端程序员之路 22、RESTful API

    理解RESTful架构 - 阮一峰的网络日志http://www.ruanyifeng.com/blog/2011/09/restful.html RESTful API 设计指南 - 阮一峰的网络日 ...

  9. 后端程序员之路 16、信息熵 、决策树、ID3

    信息论的熵 - guisu,程序人生. 逆水行舟,不进则退. - 博客频道 - CSDN.NEThttp://blog.csdn.net/hguisu/article/details/27305435 ...

随机推荐

  1. Codeforces Round #633 (Div. 2)

    Codeforces Round #633(Div.2) \(A.Filling\ Diamonds\) 答案就是构成的六边形数量+1 //#pragma GCC optimize("O3& ...

  2. 分块 && 例题 I Hate It HDU - 1754

    分块算法: 分块就是对暴力方法的一种优化:                          _ 假设我们总共的序列长度为n,然后我们把它切成√n 块,然后把每一块里的东西当成一个整体来看,完整块:被 ...

  3. Python 读Excel数据

    一.读取Excel数据的步骤及方式: 1.打开Excel文件 data = xlrd.open_workbook(r'D:\Interface_test\test_data\测试用例.xlsx') 2 ...

  4. 大规模数据爬取 -- Python

    Python书写爬虫,目的是爬取所有的个人商家商品信息及详情,并进行数据归类分析 整个工作流程图: 第一步:采用自动化的方式从前台页面获取所有的频道 from bs4 import Beautiful ...

  5. 对模拟器虚假设备识别能力提升15%!每日清理大师App集成系统完整性检测

    前言 每日清理大师是一款智能便捷的手机清理软件,可快速清理无用缓存.垃圾文件和应用残留,还可深度清理如社交软件中的无用缓存等,有效解决手机卡顿.耗电快.内存不足等问题.每日清理大师App在结合了系统完 ...

  6. VScode 配置c++环境

    参考 https://code.visualstudio.com/docs/cpp/config-mingw https://zhuanlan.zhihu.com/p/77645306 主要 http ...

  7. 关于优先队列的总结II

    优先队列这个数据结构还是很有用的,可以帮我们解决很多棘手的排序的问题,所以再来细细看一下, priority_queue<Type, Container, Functional> Type ...

  8. Docker下载Mysql 2059

    接着我上一篇的,在我们安装好docker后我们尝试在docker里面安装mysql并连接使用 正式开始 1.启动docker 2.打开Windows PowerShell(执行下载命令) `docke ...

  9. Vue Component Registration All In One

    Vue Component Registration All In One Vue 注册自定义组件 <template> <div class="back-to-top-c ...

  10. 微信小程序-导航 & 路由

    微信小程序-导航 & 路由 页面跳转 页面路由 页面栈, 框架以栈的形式维护了当前的所有页面. https://developers.weixin.qq.com/miniprogram/dev ...