我写了一个小地图程序来阅读日志文件并寻找一个叫做“提取”的词。仅当找到该单词时,它才应将该行写入上下文对象。但不知何故,我看到了输出文件中的所有行。这是我的代码
        public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        StringTokenizer tokenizer = new StringTokenizer(line);
        while (tokenizer.hasMoreTokens()) {
            word.set(tokenizer.nextToken());
            if(word.find("extract") >= -1) {
                context.write(word, null);
            }
        }
    }
你能告诉我我做错了什么吗?谢谢,阿蒂