0

私はsolrについて学んでいますが、あいまいさが多すぎます。

This is solr response:
http://94.229.169.64:8983/solr/collection1/search-en?q=craft%20base&wt=json

新しいページにコンテンツを取り込む方法

PHP Solarium を使用しようとしましたが、応答が同じではありません。

// 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

しかし、上記の solr URL をクリックすると、結果は 31 になります。

solr の応答を取得する方法を教えてください。

ありがとうございました

4

1 に答える 1

0

うーん...あなたのPHPクライアントは、どういうわけかより多くの結果を返すわずかに異なるリクエストを行っているようです。

PHP ページが SOLR サーバーに対して行っている要求の種類を正確に確認するには、wireshark などのツールを使用してみてください。

http://www.wireshark.org/download.html

その後、さらにサポートが必要な場合は、PHP ページが行うリクエストを SOLR サーバーに送信してください。違いを比較して把握することができます。

于 2013-09-09T09:22:44.630 に答える