그냥 solr 학습을 시작했습니다. solrpy를 클라이언트로 사용하려고합니다. 내 파이썬 코드는 다음과 같습니다이 내 SOLR의의 schema.xml이 SOLR 배포와 함께 제공되는 기본 스키마입니다 heresolrpy로 Solr 색인 생성 문제
주어진 예에서입니다
import solr
# create a connection to a solr server
s = solr.SolrConnection('http://localhost:8983/solr')
# add a document to the index
doc = dict(
id='testid123',
title='Lucene in Action',
author=['Erik Hatcher', 'Otis Gospodneti'],
)
s.add(doc, commit=True)
# do a search
response = s.query('title:lucene')
for hit in response.results:
print hit['title']
. 나는 그것을 조금도 변경하지 않았다. 그것은 "id"로 uniqueKey 필드를 가지고 있습니다. 내 클라이언트 측에서 내 코드를 실행할 때
<uniqueKey>id</uniqueKey>
그리고 그것은 문자열 유형이다
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
아직도 내가 얻을 오류 :
Traceback (most recent call last):
File "/Users/user1/Documents/workspace/PyDelight/src/Test.py", line 12, in <module>
s.add(doc, commit=True)
File "/Library/Python/2.7/site-packages/solrpy-0.9.5-py2.7.egg/solr/core.py", line 678, in add
return Solr.add_many(self, [fields], commit=_commit)
File "/Library/Python/2.7/site-packages/solrpy-0.9.5-py2.7.egg/solr/core.py", line 326, in wrapper
return self._update(content, query)
File "/Library/Python/2.7/site-packages/solrpy-0.9.5-py2.7.egg/solr/core.py", line 550, in _update
rsp = self._post(selector, request, self.xmlheaders)
File "/Library/Python/2.7/site-packages/solrpy-0.9.5-py2.7.egg/solr/core.py", line 639, in _post
return check_response_status(self.conn.getresponse())
File "/Library/Python/2.7/site-packages/solrpy-0.9.5-py2.7.egg/solr/core.py", line 1097, in check_response_status
raise ex
solr.core.SolrException: HTTP code=400, reason=Bad Request
내가 얻을 SOLR 추적 측 오류 :
843169 [qtp1151734776-20] INFO org.apache.solr.update.processor.LogUpdateProcessor ? [collection1] webapp=/solr path=/update params={commit=true} {} 0 0
843170 [qtp1151734776-20] ERROR org.apache.solr.core.SolrCore ? org.apache.solr.common.SolrException: Document is missing mandatory uniqueKey field: id
schema.xml 파일/example/solr/collection1/conf
그리고 예제 디렉토리에서 start.jar을 실행하여 solr을 실행하고 있습니다.
어디서 잘못 생각하나요?
문제는 매개 변수가 전달 될 수있는 방법을 참이었다. 여전히 '커밋'프로세스에는 몇 가지 문제가 있습니다. 그러나 당신의 제안에 나는 햇볕에 타서 시간을 보낼 것입니다. 그것으로 건너 뛰고 설명서가 훨씬 자세하게 보입니다. 감사 :) – rishi