Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将php数组转换为solr索引_Php_Mysql_Solr - Fatal编程技术网

将php数组转换为solr索引

将php数组转换为solr索引,php,mysql,solr,Php,Mysql,Solr,我一直在使用mysql只是为了练习存储数据。我要做的是获取html文档的textnodes、它相对于文档的y坐标以及url。我想知道如何直接在solr中实现这一点(因为它使用xml)。一些一般性的指导也会很好 for($i=0; $i<count($textnode); $i++) { $textnode[$i] = stripslashes($textnode[$i]); $textnode[$i] = mysql_real_escape_string($textnode[$i], $

我一直在使用mysql只是为了练习存储数据。我要做的是获取html文档的textnodes、它相对于文档的y坐标以及url。我想知道如何直接在solr中实现这一点(因为它使用xml)。一些一般性的指导也会很好

for($i=0; $i<count($textnode); $i++) {

$textnode[$i] = stripslashes($textnode[$i]);
$textnode[$i] = mysql_real_escape_string($textnode[$i], $con);



 mysql_query("INSERT INTO paragraphs (paragraphs, ytext, url)
 VALUES ('$textnode[$i]','$ytext[$i]', '$url')");



}

对于($i=0;$i您可以在php脚本中使用一个可用的xml文档库(最简单的可能不止一个)。solr的xml格式在他们的wiki()中进行了描述

然后用一些名称(由schema.xml配置)将字段添加到文档中,并将其发布到solr接口

例如,请参阅使用curl.PHP的示例,它还有一个curl库。因此,您可以轻松地在那里实现任何东西