solr PHP 클라이언트를 사용하려고합니다. 400 상태를 반환하는 문서를 추가하려고 할 때. 나는 내가 뭘 잘못하고 나는 solr에 새로운지 잘 모릅니다. 아래는 내 code 및 schema.xml 파일입니다.Solr 400 상태 : 잘못된 요청
내가 사전에 7
감사를 SOLR의 4.10.3과 바람둥이를 사용하고
$solr = new Apache_Solr_Service('localhost', '8080', '/solr/#/core0');
if (!$solr->ping()) {
echo 'Solr service not responding.';
exit;
} else {
$fileContent = $_GET['fileContent'];
$title = trim($_GET['title']);
$desription = $_GET['description'];
$fileId = trim($_GET['fileId']);
$docs = array(
'doc1' => array(
'id' => 1,
'fileid' => 'file1',
'title' => 'title1'
));
$documents = array();
$part = new Apache_Solr_Document();
foreach ($docs as $item => $fields) {
foreach ($fields as $key => $value) {
if (is_array($value)) {
foreach ($value as $data) {
$part->setMultiValue($key, $data);
}
}
else {
$part->$key = $value;
}
}
$documents[] = $part;
}
// Load the documents into the index
try {
$a = $solr->addDocuments($documents);
$solr->commit();
$solr->optimize();
} catch (Exception $e) {
echo $e->getMessage();
}
die;
$offset = 0;
$limit = 10;
$queries = array('id:'.$fileId);
foreach ($queries as $query) {
$response = $solr->search($query, $offset, $limit);
if ($response->getHttpStatus() == 200) {
// print_r($response->getRawResponse());
if ($response->response->numFound > 0) {
echo "$query <br />";
foreach ($response->response->docs as $doc) {
echo "$doc->id $doc->title <br />";
}
echo '<br />';
}
} else {
echo $response->getHttpStatusMessage();
}
}
}
}
의 schema.xml
<schema name="example core zero" version="1.1">
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
<field name="id" type="long" indexed="true" stored="true"/>
<field name="fileid" type="string" indexed="true" stored="true" required="true"/>
<field name="title" type="string" indexed="true" stored="true" />
<uniqueKey>id</uniqueKey>
</schema>
Solr 로그에 더 많은 정보가 있습니다 (Solr 관리 UI의 "logging"탭 참조). – Yann
Logg 오후 6시 19분 53초 이 여러 RequestHandler를 같은 이름으로 등록 RequestHandlers 경고, 2015년 2월 2일으로 보여주는 :/업데이트 무시 : org.apache.solr.handler.UpdateRequestHandler 2015년 2월 2일, (6) : 21 : 39 PM ERROR ShowFileRequestHandler 찾을 수없는 항목 : admin-extra.menu-bottom.html [/usr/share/solr/example/multicore/core0/conf/admin-extra.menu-bottom.html] –