使用Mongodb检查小型爬虫中URL的存在

时间:2015-02-02 11:42:34

标签: mongodb lucene

我正在使用MongoDB在小型抓取工具中索引网址。我的抓取工具中的最大网址数约为5亿个网址。我想在URLdb中搜索以检查现有的URL,但是此查询中MongoDB在搜索中的速度非常低:

db.hosts.find({URL:"http://myhost.com"})

我的问题是:

  1. 如何提高MongoDB的搜索速度?
  2. 就我的目的而言,Lucene是否比MongoDB更好?

1 个答案:

答案 0 :(得分:0)

  1. It's fairly well established in the documentation that the way to improve query performance is by adding an index to the field on which you are querying

  2. 关于你所做的事情的信息量不足以让任何人判断Lucene是否会比MongoDB更好。

  3. 此外,如果您在URL搜索现有网址,以便不添加副本,那么您想要的是create a unique index

相关问题