数据配置文件

<dataConfig>
 <dataSource encoding="UTF-8" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/somevisits" user="root" password=""/>
 <document name="somevisits">
  <entity name="login" query="select * from login">
   <field column="sv_id" name="sv_id" />
   <field column="sv_username" name="sv_username" />
  </entity>
 </document>
</dataConfig>


schema.xml

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.5">
    <fields>
        <field name="sv_id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
        <field name="sv_username" type="string" indexed="true" stored="true" required="true"/>
        <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
        <field name="text" type="string" indexed="true" stored="false" multiValued="true"/>
    </fields>
    <uniqueKey>sv_id</uniqueKey>
    <types>
        <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
        <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
    </types>
</schema>


Solr使用完整的http:// [localSolr]:8983 / solr /#/ collection1 / dataimport?command = full-import成功导入了mysql数据库

我的问题是,现在如何访问该mysql导入的数据库?

最佳答案

如果要搜索索引数据,则下面是用于搜索索引数据的URL。

http://[localSolr]:8983/solr/CORE_NAME/admin


这将打开搜索界面。默认情况下,搜索字符串是:它将提供所有索引文档作为结果。在这里,第一个*代表字段名称,第二个*代表关键字。您可以在特定字符串中搜索特定字段,即用户名:USERNAME或sv_id:YOURID。或者,如果您只给出关键字而没有给出任何字段名称“ mykeyword”,则它将在您的默认搜索字段中搜索该关键字。

07-24 09:54
查看更多