【发布时间】:2014-12-02 19:12:18
【问题描述】:
我有一个用 Solr 索引的 MySQL 数据库,出于我的目的,我需要查询这个数据库中的数据。 我想执行“软”查询,就像网络上的每个搜索引擎一样。
我正在尝试在 schema.xml 中设置两个示例字段
<uniqueKey>organization_id</uniqueKey>
<field name="organization_id" type="string" indexed="true" stored="true" required="true"/>
<field name="name" type="string" indexed="true" stored="true"/>
这是我的 solrconfig.xml
<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
最后,data-config.xml
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/organizations2" user="****" password="****" />
<document name="content">
<entity name="id" query="SELECT * FROM organization"
deltaImportQuery="SELECT * FROM organization"
deltaQuery="SELECT * FROM organization">
<field column="organization_id" name="organization_id" />
<field column="name" name="name" />
</entity>
</document>
</dataConfig>
是否可以使用相似的组织名称进行经典查询,然后返回正确的公司? 我试图搜索一整天但没有解决方案。
非常感谢
【问题讨论】: