Solr DataImportHandler is not indexing all data defined

时光总嘲笑我的痴心妄想 提交于 2019-11-29 17:57:39

My dear friend you have simply mis-typed one of the fields. Try this link and you'd want to laugh and cry at the same time.

http://localhost:8983/solr/wiki/select?q=*%3A*&fl=id+titleText+user+revision&wt=json&indent=true

The title you mentioned in the schema is "titleText" and your limit mentioned "title" and "text" seperately. So God speed and you can stay in touch with me via hangouts: porous999@gmail.com

The provided setting will work fine with classic schema only. But at solrconfig by default managed schema was enabled. Due to which I was not getting text. For managed schema I need not to define "schema.xml" and I should define fields in data-config.xml like below.

 <field column="id"        xpath="/mediawiki/page/id" />
            <field column="title_s"     xpath="/mediawiki/page/title" />
            <field column="revision"  xpath="/mediawiki/page/revision/id" />
            <field column="user_s"      xpath="/mediawiki/page/revision/contributor/username" />
            <field column="userId"    xpath="/mediawiki/page/revision/contributor/id" />
            <field column="text_s"      xpath="/mediawiki/page/revision/text" />
            <field column="timestamp" xpath="/mediawiki/page/revision/timestamp" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'" />
            <field column="$skipDoc"  regex="^#REDIRECT .*" replaceWith="true" sourceColName="text"/>

I was recently trying the same wikipedia import with Solr 7. The reason text isn't returned is because that field in the managed_schema is set to stored="false":

<field name="text" type="text_en" indexed="true" stored="false"/>

Changing it to stored="true" will return the text.

The current accepted answer suggests using the text_s field, which was probably stored in the managed_schema of the Solr version OP was using. Note that searching for terms included in any field that is not stored will still return the relevant document, only the text itself is not returned. See the answer here for more info: Solr index vs stored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!