solr 응용
앞에서 solr 의 설 치 를 소 개 했 습 니 다. 다음은 solr 의 사용 을 소개 합 니 다. 근원
http://lucene.apache.org/solr/tutorial.html
1. 색인 만 들 기
디 렉 터 리 를 exampledocs 로 변환:
D:\soft\apache-solr-1.4.1\apache-solr-1.4.1\example>cd exampledocs 색인 만 들 기:
D:\soft\apache-solr-1.4.1\apache-solr-1.4.1 \example\exampledocs>[color=green]java -jar post.jar solr.xml monitor.xml[/color]SimplePostTool: version 1.2
SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, other encodings are not currently supported
SimplePostTool: POSTing files to http://localhost:8983/solr/update..
SimplePostTool: POSTing file solr.xml
SimplePostTool: POSTing file monitor.xml
SimplePostTool: COMMITting Solr index changes.. 현재 solr 에서 파일 solr. xml, monitor. xml 에 색인 을 만 들 었 습 니 다. 지금 은
Make a Query
모든. xml 파일 에 색인 을 만 들 수도 있 습 니 다:
D:\soft\apache-solr-1.4.1\apache-solr-1.4.1example\exampledocs>java -jar post.jar *.xml
SimplePostTool: version 1.2
SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, other encodings are not currently supported
SimplePostTool: POSTing files to http://localhost:8983/solr/update..
SimplePostTool: POSTing file hd.xml
SimplePostTool: POSTing file ipod_other.xml
SimplePostTool: POSTing file ipod_video.xml
SimplePostTool: POSTing file mem.xml
SimplePostTool: POSTing file monitor.xml
SimplePostTool: POSTing file monitor2.xml
SimplePostTool: POSTing file mp500.xml
SimplePostTool: POSTing file payload.xml
SimplePostTool: POSTing file sd500.xml
SimplePostTool: POSTing file solr.xml
SimplePostTool: POSTing file utf8-example.xml
SimplePostTool: POSTing file vidcard.xml
SimplePostTool: COMMITting Solr index changes.. 색인 을 만 든 후에 solr 문법 을 사용 하여 검색 할 수 있 습 니 다.
solr 데이터 가 져 오 는 방법:
데이터베이스 에 기 록 된 가 져 오기: Data Import Handler (DIH) 를 사용 합 니 다.
http://localhost:8983/solr/admin/
Load a CSV file (comma separated values), including those exported by Excel or MySQL.
바 이 너 리 파일 (예: Word, PDF) 에 색인 만 들 기: Solr Cell (Extracting RequestHandler) 을 사용 합 니 다.
SolrJ for Java 또는 다른 Solr 클 라 이언 트 로 문 서 를 작성 하여 solr 에 제공 합 니 다.
2. 데이터 삭제
명령:
java -Ddata=args -Dcommit=no -jar post.jar "<delete><id>SP2514N</id></delete>" 터미널 디 스 플레이:
D:\soft\apache-solr-1.4.1\apache-solr-1.4.1\example\exampledocs>java -Ddata=args -Dcommit=no -jar post.jar "<delete><id>SP2514N</id></delete>"
SimplePostTool: version 1.2
SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, other encodings are not currently supported SimplePostTool: POSTing args to http://localhost:8983/solr/update.. 있다http://localhost:8983/solr/admin/의 statistics 페이지 의 UPDATEHANDLERS 의 "deletesById: 1"
그러나 이 때 검색 id: SP 2514 N 은 색인 변경 이 보이 지 않 기 때문에 발견 할 수 있 습 니 다.색인 에서 도 변경 하려 면:
java -jar post.jar 이때 statistics 의 CORE 와 UPDATE한 들 러 스에 서 변 화 를 볼 수 있다.
다른 연습 (색인 을 포함 하여 모든 이름 에 DDR 이 포 함 된 문 서 를 삭제 합 니 다):
java -Ddata=args -jar post.jar "<delete><query>name:DDR</query></delete>" - Dcommt 매개 변 수 는 제어 색인 에서 보이 지 않 는 것 으로 추정 된다.
그리고 가능 합 니 다.
java -jar post.jar *.xml 이전 색인 에 있 는 모든 데 이 터 를 복원 합 니 다.
위 는 solr 의 데이터 업데이트 와 삭제 작업 입 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Is Eclipse IDE dying?In 2014 the Eclipse IDE is the leading development environment for Java with a market share of approximately 65%. but ac...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.