You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jörg Agatz <jo...@googlemail.com> on 2011/07/14 20:48:20 UTC

import Data via PHP

hallo users...

i have a Problem..

I have ti indexin Data via PHP.. the Information for data existing... and
the Fiels too..

<?php
$id = $_POST['id'];
$name = $_POST['name'];
$url = $_POST['url'];
$color = $_POST['color'];
$size = $_POST['size'];
ect...
?>

"fields id, name, url, color, size" are existing in schema, and it work..


But how can i send it to solr, i try it with curl.. but it dosent work

curl "
http://myserver/solr/update/extract?commit=true&literal.id=$id&literal.name=$name&literal.url=$url&literal.size=$size&stream.file=
"

RE: import Data via PHP

Posted by Brian Gerby <br...@hotmail.com>.
Joerg - 
In your PHP code, you can create a snippet of XML with your fields and send that to your solr server via a form post. Example of XML Schema here http://wiki.apache.org/solr/UpdateXmlMessages. 



> Date: Thu, 14 Jul 2011 20:48:20 +0200
> Subject: import Data via PHP
> From: joerg.agatz@googlemail.com
> To: solr-user@lucene.apache.org
> 
> hallo users...
> 
> i have a Problem..
> 
> I have ti indexin Data via PHP.. the Information for data existing... and
> the Fiels too..
> 
> <?php
> $id = $_POST['id'];
> $name = $_POST['name'];
> $url = $_POST['url'];
> $color = $_POST['color'];
> $size = $_POST['size'];
> ect...
> ?>
> 
> "fields id, name, url, color, size" are existing in schema, and it work..
> 
> 
> But how can i send it to solr, i try it with curl.. but it dosent work
> 
> curl "
> http://myserver/solr/update/extract?commit=true&literal.id=$id&literal.name=$name&literal.url=$url&literal.size=$size&stream.file=
> "
 		 	   		  

RE: import Data via PHP

Posted by Alexander Golubowitsch <al...@antikoerper-online.de>.
Hi Jörg,

what exactly do you mean by "it doesn't work"? Is there some kind of error
message?

In any case you will at least want to url_encode() the data you add into
that Curl url.
Generally:
- You can import data e.g. via a CSV file
- You can use the Solr PHP PECL extension (which offers a few classes for
accessing a Solr instance)

 

-----Original Message-----
From: Jörg Agatz [mailto:joerg.agatz@googlemail.com] 
Sent: Donnerstag, 14. Juli 2011 20:48
To: solr-user@lucene.apache.org
Subject: import Data via PHP

hallo users...

i have a Problem..

I have ti indexin Data via PHP.. the Information for data existing... and
the Fiels too..

<?php
$id = $_POST['id'];
$name = $_POST['name'];
$url = $_POST['url'];
$color = $_POST['color'];
$size = $_POST['size'];
ect...
?>

"fields id, name, url, color, size" are existing in schema, and it work..


But how can i send it to solr, i try it with curl.. but it dosent work

curl "
http://myserver/solr/update/extract?commit=true&literal.id=$id&literal.name=
$name&literal.url=$url&literal.size=$size&stream.file=
"