2012-10-02 30 views
0

我想索引從日光浴室和PHP MySQL的表。爲了測試,我列出了一些國家,並在Solr中建立了一個核心,以反映我在查詢中檢索的字段。嘗試添加這些使用日光浴室時,我得到一個錯誤:Solr HTTP錯誤'未知字段'使用日光浴場的錯誤

Fatal error: Uncaught exception 'Solarium_Client_HttpException' with message 'Solr HTTP error: ERROR: [doc=1] unknown field 'code' (400)' in solariumQuickStart\Library\Solarium\Result.php on line 98 
(!) Solarium_Client_HttpException: Solr HTTP error: ERROR: [doc=1] unknown field 'code' (400) in solariumQuickStart\Library\Solarium\Result.php on line 98 

這裏是我的代碼:

foreach($worldDBRecords as $record) 
{ 

    // create a new document for the data 
    $doc = $update->createDocument(); 
    $doc->code = $record[0]; 
    $doc->name = $record[1]; 
    $doc->continent = $record[2]; 
    $doc->region = $record[3]; 
    $doc->population = $record[4]; 
    $update->addDocument($doc); 
} 

$update->addCommit(); 
$result = $client->update($update); 

我到Solr的連接工作,我已經定義在我Solarium_Client配置的核心。我也有我的模式文件中定義的代碼字段,但它不被識別。任何幫助表示讚賞。謝謝。

+0

你停下來你的Schema.xml文件定義代碼後場重新啓動Solr的?直到Solr重新啓動後纔會反映更改。 –

+0

感謝您的回覆,佩奇。進行任何更改後我會重新啓動Solr。由於日光浴室只向Solr發送文檔,實際上並沒有讀取模式文件,我相信問題在於我的Solr Core配置。仍試圖通過這個工作。 – Drew

回答

1

我重新設置我的Solr核心以確保我的配置是正確的。另外,我失蹤了,我日光浴室配置了「adapteroptions」設置,在此之後的工作:

$config = array(
'adapteroptions' => array(
'host' => 'localhost', 
'port' => 8983, 
'path' => '/solr/', 
'core' => 'world' 
) 
);