使用mongo-connector时的json.decoder.JSONDecodeError

时间:2018-03-09 11:06:18

标签: mongodb solr

我正在关注this以将<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>Form</class> <widget class="QWidget" name="Form"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>448</width> <height>300</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QWidget" name="widget" native="true"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1"> <item> <widget class="QWidget" name="widget_3" native="true"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <spacer name="horizontalSpacer_6"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>157</width> <height>27</height> </size> </property> </spacer> </item> <item> <widget class="QFrame" name="frame"> <property name="minimumSize"> <size> <width>100</width> <height>100</height> </size> </property> <property name="maximumSize"> <size> <width>100</width> <height>100</height> </size> </property> <property name="frameShape"> <enum>QFrame::Box</enum> </property> <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> </widget> </item> <item> <spacer name="horizontalSpacer_7"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>157</width> <height>27</height> </size> </property> </spacer> </item> </layout> </widget> </item> <item> <widget class="QGroupBox" name="groupBox"> <property name="minimumSize"> <size> <width>100</width> <height>30</height> </size> </property> <property name="maximumSize"> <size> <width>100</width> <height>30</height> </size> </property> <property name="title"> <string>Title</string> </property> </widget> </item> <item> <spacer name="horizontalSpacer_5"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>147</width> <height>27</height> </size> </property> </spacer> </item> </layout> </widget> </item> <item> <widget class="QWidget" name="widget_2" native="true"> <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeType"> <enum>QSizePolicy::Preferred</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>97</width> <height>108</height> </size> </property> </spacer> </item> <item> <widget class="QGroupBox" name="groupBox_2"> <property name="minimumSize"> <size> <width>200</width> <height>100</height> </size> </property> <property name="title"> <string>GroupBox</string> </property> </widget> </item> <item> <spacer name="horizontalSpacer_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeType"> <enum>QSizePolicy::Preferred</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>97</width> <height>108</height> </size> </property> </spacer> </item> </layout> </widget> </item> </layout> </widget> <resources/> <connections/> </ui> solr联系起来。当我调用mongo时,我收到以下错误。

mongo-connector

我使用的数据库是根据solr提供的示例电影数据创建的。这是$ mongo-connector --unique-key=id -n test.films -m localhost:27017 -t http://localhost:8983/solr/#/films -d solr_doc_manager Traceback (most recent call last): File "/usr/bin/mongo-connector", line 11, in <module> sys.exit(main()) File "/usr/lib/python3.6/site-packages/mongo_connector/util.py", line 104, in wrapped func(*args, **kwargs) File "/usr/lib/python3.6/site-packages/mongo_connector/connector.py", line 1275, in main conf.parse_args() File "/usr/lib/python3.6/site-packages/mongo_connector/config.py", line 120, in parse_args option, dict((k, values.get(k)) for k in option.cli_names)) File "/usr/lib/python3.6/site-packages/mongo_connector/connector.py", line 1024, in apply_doc_managers dm_instances.append(DocManager(target_url, **kwargs)) File "/usr/lib/python3.6/site-packages/mongo_connector/doc_managers/solr_doc_manager.py", line 80, in __init__ self._build_fields() File "/usr/lib/python3.6/site-packages/mongo_connector/util.py", line 35, in wrapped return f(*args, **kwargs) File "/usr/lib/python3.6/site-packages/mongo_connector/doc_managers/solr_doc_manager.py", line 97, in _build_fields result = decoder.decode(declared_fields) File "/usr/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

schema.xml

我在线搜索并检查<?xml version="1.0" encoding="UTF-8" ?> <schema name="example" version="1.5"> <field name="id" type="string" indexed="true" stored="true" multiValued="false" /> <field name="directed_by" type="string" indexed="true" stored="true" multiValued="true" /> <field name="initial_release_date" type="string" indexed="true" stored="true" multiValued="false"/> <field name="genre" type="string" indexed="true" stored="true" multiValued="true"/> <field name="name" type="string" indexed="true" stored="true" multiValued="false"/> <field name="_version_" type="long" indexed="true" stored="true"/> <uniqueKey>id</uniqueKey> <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/> <fieldType name="long" class="solr.LongPointField" sortMissingLast="true"/> <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"/> </schema> 上的问题,但找不到任何内容。

1 个答案:

答案 0 :(得分:0)

您为Solr集合提供的路径不是Solr的有效终点。 URL转到本地管理界面(并且具有本地锚点,服务器永远不会看到它)。该URL仅供人类使用,并将提供HTML(而不是连接器所期望的JSON)。

如果您使用实际的集合端点:

http://localhost:8983/solr/films 

..该错误消息应该消失。如果您引用了您关注的指南,则可以使用相同的格式:-t http://localhost:8983/solr/wlslog(没有本地的,意味着浏览器的锚点)。