CI 코드

제목 Elastic Search엔진 CI 라이브러리 입니다.
글쓴이 한대승(불의회상) 작성시각 2014/05/29 11:33:18
댓글 : 4 추천 : 0 스크랩 : 1 조회수 : 19361   RSS
한대승(불의회상)
라이브러리라 쓰고 랩퍼(Wrapper)라 부른다... ㅡㅡ;;

이번 프로젝트에 검색엔진을 도입하게 되었는데 적절한 CI 라이브러리가 없어 공식 홈피에 있는 드라이버 가져다 날로 먹었습니다.

Elastic Search엔진 드라이버를 사용하기 위해선 PHP 5.3.9 이상 버젼이 필요 합니다.

문서는 아래 URL을 참고 하시면 됩니다.

URL : http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/

* install
1. 압축 파일을 다운 받아 해제 합니다.
2. 각 디렉토리 위치에 맞게 복사해 넣으시면 됩니다.

* 사용방법
$this->load->library('elastic');

// index a document
$params = array();
$params['body']  = array('testField' => 'abc');
$params['index'] = 'my_index';
$params['type']  = 'my_type';
$params['id']    = 'my_id';
$ret = $this->elastic->index($params);

// get a document
$getParams = array();
$getParams['index'] = 'my_index';
$getParams['type']  = 'my_type';
$getParams['id']    = 'my_id';
$retDoc = $this->elastic->get($getParams);

// search for a document
$searchParams['index'] = 'my_index';
$searchParams['type']  = 'my_type';
$searchParams['body']['query']['match']['testField'] = 'abc';
$retDoc = $this->elastic->search($searchParams);

// delete a document
$deleteParams = array();
$deleteParams['index'] = 'my_index';
$deleteParams['type'] = 'my_type';
$deleteParams['id'] = 'my_id';
$retDelete = $this->elastic->delete($deleteParams);

더욱 자세한 내용은 Elastic 웹사이트를 확인 하세요.

웹 사이트 : http://www.elasticsearch.org/
태그 Elastic,Search,엘라스틱,서치엔진
첨부파일 elastic_search.zip (1.7 MB)
 다음글 커스텀 페이지네이션 라이브러리 (9)
 이전글 고정형 페이지네이션 라이브러리 (8)

댓글

/ 2014/07/03 10:30:13 / 추천 0
//불의회상

오호 검색엔진 .. 혹시 소스코드가 공개되어 있나요 ?

크롤러가 사이트를 긁어서 저장하는 건가요?

어떻게 동작하는지요?
변종원(웅파) / 2014/07/03 10:38:25 / 추천 0
닉/ 하단의 링크 들어가보시면 될 것 같은데요? ^^
변종원(웅파) / 2014/07/03 11:01:30 / 추천 0
logstash 마음에 드네요. ^^
조현 / 2014/10/13 17:19:04 / 추천 0