如何在mysql和php中使用solr? [英] how to use solr with mysql and php?

查看:74
本文介绍了如何在mysql和php中使用solr?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了有关如何使用solr在线程中进行搜索的信息,但是我不太了解它是如何工作的,并且我找不到任何有关初学者的文章来对此进行解释.

有人可以简要解释一下solr的工作原理以及它如何与mysql和php通信吗?

解决方案

首先查看本教程.

使用solr,您将需要一个xml(或 csv )文档,该文档将是推送到solr(过程称为更新;建立索引是使字段可用于搜索的过程). xml的格式是sth.像:

<add>
  <doc>
    <field name="id">9885A004</field>
    <field name="name">Canon PowerShot SD500</field>
    <field name="category">camera</field>
    <field name="features">3x optical zoom</field>
    <field name="features">aluminum case</field>
    <field name="weight">6.4</field>
    <field name="price">329.95</field>
  </doc>
</add>

此处中查找更多信息.

但是,在您的情况下,您可以使用搜寻器(如果使用不同的来源或外部来源,则应使用)来识别不同的文档格式. 尝试了解 Nutch 是否可以在这里提供帮助.

例如请查看此演示文稿,以获得有关solr,lucene和nutch的解释.

i read about how i could use solr to search in my threads but i dont quite understand how it works and i cant find any articles explaining this for a total beginner.

could someone explain briefly how solr works and how it communicate with mysql and php?

解决方案

First take a look at this tutorial.

With solr you will need to have an xml (or csv) document which will be pushed to solr (process is called updating; indexing is the process to make fields available for search). The format of xml is sth. like:

<add>
  <doc>
    <field name="id">9885A004</field>
    <field name="name">Canon PowerShot SD500</field>
    <field name="category">camera</field>
    <field name="features">3x optical zoom</field>
    <field name="features">aluminum case</field>
    <field name="weight">6.4</field>
    <field name="price">329.95</field>
  </doc>
</add>

Look here for more details.

But in your case you could use a crawler (appropriated if different or external sources) to get different document formats recognized. Try to understand if Nutch could help here.

E.g. take a look at this presentation for an explanation about solr, lucene and nutch.

这篇关于如何在mysql和php中使用solr?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆