Monday, 9 September 2013

How to get the solr response into new page

How to get the solr response into new page

I'm learning about solr but there's too much ambiguity.
This is solr response:
http://94.229.169.64:8983/solr/collection1/search-en?q=craft%20base&wt=json
How to get content into the new page
I have tried to use the PHP Solarium but the response is not the same.
// create a client instance
$client = new Solarium_Client();
// get a select query instance
$query = $client->createSelect();
// set a query (all prices starting from 12)
$query->setQuery('craft base');
// set start and rows param (comparable to SQL limit) using fluent interface
$query->setStart(1)->setRows(20);
// set fields to fetch (this overrides the default setting 'all fields')
//$query->setFields(array('id','name','price'));
// sort the results by price ascending
$query->addSort('price', Solarium_Query_Select::SORT_ASC);
// this executes the query and returns the result
$resultset = $client->select($query);
// display the total number of documents found by solr
echo 'NumFound: '.$resultset->getNumFound(); // result = 182
but when you click the solr URL above, the result is 31.
Can you let me know how to get the solr response ?
Thank you

No comments:

Post a Comment