简体   繁体   English

将mongo-connector限制为特定集合以进行Solr索引

[英]Limit mongo-connector to a specific collection for Solr indexing

I am currently attempting to use mongo-connector to automatically feed db updates to Solr. 我目前正在尝试使用mongo-connector自动将数据库更新提供给Solr。 It's working fine through the use of the following command - 通过使用以下命令,它可以正常工作-

mongo-connector -m localhost:27017 -t http://localhost:8983/solr -d mongo_connector/doc_managers/solr_doc_manager.py

However, it is indexing every collection in my mongodb. 但是,它正在索引我的mongodb中的每个集合。 I have tried the use of the option -n through the following - 我已经尝试通过以下方式使用-n选项-

mongo-connector -m localhost:27017 -t http://localhost:8983/solr -n feed_scraper_development.articles -d mongo_connector/doc_managers/solr_doc_manager.py

This fails with the following error - 失败并显示以下错误-

2014-07-24 22:23:23,053 - INFO - Beginning Mongo Connector
2014-07-24 22:23:23,104 - INFO - Starting new HTTP connection (1): localhost
2014-07-24 22:23:23,110 - INFO - Finished 'http://localhost:8983/solr/admin/luke?show=schema&wt=json' (get) with body '' in 0.018 seconds.
2014-07-24 22:23:23,115 - INFO - OplogThread: Initializing oplog thread
2014-07-24 22:23:23,116 - INFO - MongoConnector: Starting connection thread MongoClient('localhost', 27017)
2014-07-24 22:23:23,126 - INFO - Finished 'http://localhost:8983/solr/update/?commit=true' (post) with body 'u'<commit ' in 0.006 seconds.
2014-07-24 22:23:23,129 - INFO - Finished 'http://localhost:8983/solr/select/?q=%2A%3A%2A&sort=_ts+desc&rows=1&wt=json' (get) with body '' in 0.003 seconds.
2014-07-24 22:23:23,337 - INFO - Finished 'http://localhost:8983/solr/select/?q=_ts%3A+%5B6038164010275176560+TO+6038164010275176560%5D&rows=100000000&wt=json' (get) with body '' in 0.207 seconds.
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 808, in __bootstrap_inner
    self.run()
  File "build/bdist.macosx-10.9-intel/egg/mongo_connector/oplog_manager.py", line 141, in run
    cursor = self.init_cursor()
  File "build/bdist.macosx-10.9-intel/egg/mongo_connector/oplog_manager.py", line 582, in init_cursor
    cursor = self.get_oplog_cursor(timestamp)
  File "build/bdist.macosx-10.9-intel/egg/mongo_connector/oplog_manager.py", line 361, in get_oplog_cursor
    timestamp = self.rollback()
  File "build/bdist.macosx-10.9-intel/egg/mongo_connector/oplog_manager.py", line 664, in rollback
    if doc['ns'] in rollback_set:
KeyError: 'ns'

Any help or clues would be greatly appreciated! 任何帮助或线索将不胜感激!

Extra information: Solr 4.9.0 | 附加信息:Solr 4.9.0 | MongoDB 2.6.3 | MongoDB 2.6.3 | mongo-connector 1.2.1 mongo-connector 1.2.1

在删除数据文件夹中的所有索引,重新启动solr并使用-n选项重新运行该命令之后,它将按公告的方式工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM