我见过几个问题上选择正确的字段类型为MySQL的相应列的数据类型,但我的问题是有点怪。我已经在text
类型的MySQL的职位一栏,我已经试过相应field-type
它在Solr的schema.xml
例如string, text, text-ws
。但是,无论何时使用DIH导入它,它都会作为BLOB对象导入。我查了一下,这一点是text
而不是varchar
类型的字段只发生(他们获得索引为字符串)。因此,posts字段不可搜索。SOLR DIH导入MySQL的“文本”列作为BLOB这里
,我发现了这个问题,反复搜索失败后,当我做了一个Solr的查询*:*
搜索。样品响应:
<result name="response" numFound="223" start="0" maxScore="1.0">
<doc>
<float name="score">1.0</float>
<str name="solr_post_bio">[[email protected]</str>
<date name="solr_post_created_at">2011-02-21T07:02:55Z</date>
<str name="solr_post_email">[email protected]</str>
<str name="solr_post_first_name">Test</str>
<str name="solr_post_last_name">Account</str>
<str name="solr_post_message">[[email protected]</str>
<str name="solr_post_status_message_id">1</str>
</doc>
编辑:
道歉为不提供以下详细信息。
的data-config.xml
:
<document>
<entity name="posts" dataSource="jdbc" query="select
p.person_id as solr_post_person_id,
pr.first_name as solr_post_first_name,
pr.last_name as solr_post_last_name,
u.email as solr_post_email,
p.message as solr_post_message,
p.id as solr_post_status_message_id,
p.created_at as solr_post_created_at,
pr.bio as solr_post_bio
from posts p,users u,profiles pr where p.person_id = u.id and p.person_id = pr.person_id and p.type='StatusMessage'">
<field column="solr_post_person_id" />
<field column="solr_post_first_name"/>
<field column="solr_post_last_name" />
<field column="solr_post_email" />
<field column="solr_post_message" />
<field column="solr_post_status_message_id" />
<field column="solr_post_created_at" />
<field column="solr_post_bio"/>
</entity>
</document>
的schema.xml
:
<fields>
<field name="solr_post_status_message_id" type="string" indexed="true" stored="true" required="true" />
<field name="solr_post_message" type="text_ws" indexed="true" stored="true" required="true" />
<field name="solr_post_bio" type="text" indexed="false" stored="true" />
<field name="solr_post_first_name" type="string" indexed="false" stored="true" />
<field name="solr_post_last_name" type="string" indexed="false" stored="true" />
<field name="solr_post_email" type="string" indexed="false" stored="true" />
<field name="solr_post_created_at" type="date" indexed="false" stored="true" />
</fields>
<uniqueKey>solr_post_status_message_id</uniqueKey>
<defaultSearchField>solr_post_message</defaultSearchField>
请发表您的'schema.xml'和'数据config.xml'。另外,请在数据库上运行一个查询再次确认,该表实际上包含在列用于填充'solr_post_bio'正确的数据。 – nikhil500 2011-03-16 02:11:53