前言: 从IT跨度到DT,如今的数据每天都在海量的增长.面对如此巨大的数据,如何能让搜索引擎更好的工作呢?本文作为Hadoop系列的第二篇,将介绍分布式情况下搜索引擎的基础实现,即“倒排索引”. 1.问题描述 将所有不同文件里面的关键词进行存储,并实现快速检索.下面假设有3个文件的数据如下: file1.txt:MapReduce is simple file2.txt:mapReduce is powerful is simple file3.txt:Hello MapReduce bye M
倒排索引 (就是key和Value对调的显示结果) 一.需求:下面是用户播放音乐记录,统计歌曲被哪些用户播放过 tom LittleApple jack YesterdayOnceMore Rose MyHeartWillGoOn jack LittleApple John MyHeartWillGoOn kissinger LittleApple kissinger YesterdayOnceMore 二.最终的效果 Littl
MapReduce倒排索引建立 求某些单词在文章中出现多少次 有三个文档的内容,求hello,tom,jerry三个单词在其中各出现多少次 hello tom hello jerry hello tom hello jerry hello jerry tom jerry hello jerry hello tom java代码实现 定义一个Mapper类 package cn.itcast.demo2; import org.apache.hadoop.io.IntWritable; impor