简体   繁体   English

MySQL数据库在Apache Solr上建立了索引,如何通过URL访问它

[英]MySQL Database is Indexed at Apache Solr, How to access it via URL

data-config.xml 数据配置文件

<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 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 successfully imported mysql database using full http://[localSolr]:8983/solr/#/collection1/dataimport?command=full-import Solr使用完整的http:// [localSolr]:8983 / solr /#/ collection1 / dataimport?command = full-import成功导入了mysql数据库

My question is, how to access that mysql imported database now? 我的问题是,如何现在访问mysql导入的数据库?

If you want to search your indexed data then following is the URL for searching indexed data. 如果要搜索索引数据,则下面是用于搜索索引数据的URL。

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

This will open search interface. 这将打开搜索界面。 By default search string is : which will give all the indexed documents as result. 默认情况下,搜索字符串是它将提供所有索引文档作为结果。 Here first * stands for field name and second * stands for keyword. 在这里,第一个*代表字段名称,第二个*代表关键字。 You can search a specific string for a specific field ie username:USERNAME or sv_id:YOURID. 您可以在特定的字符串中搜索特定的字段,即username:USERNAME或sv_id:YOURID。 Or if you just give a keyword without giving any field name "mykeyword", then it will search this keyword in your default search field. 或者,如果您只给出关键字而没有给出任何字段名称“ mykeyword”,则它将在您的默认搜索字段中搜索该关键字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM