오늘은 더 많은 수정 및 개선 사항과 함께 몇 가지 새로운 기능을 추가한 PHP SDK 2.0.0 GA를 발표하고자 합니다. 이 블로그 게시물에서는 그 중 하나를 시연해 보겠습니다(전체 변경 사항 목록은 릴리스 정보).
전체 텍스트 검색 API
이전에 이 API에 대해 들어보셨을 수도 있지만, 이번에는 PHP에서 이 API를 보여드리겠습니다. 최소한 Couchbase 4.5를 설치했고 향상된 샘플 버킷을 설정했다고 가정합니다. 맥주 샘플 를 정의된 전체 텍스트 인덱스와 함께 사용합니다. 인덱스 구성에 대한 자세한 내용은 SDK 가이드의 전체 텍스트 검색 섹션.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php //we'll use that Cluster and Bucket for the remainder of the examples $cluster = new CouchbaseCluster('couchbase://localhost'); $bucket = $cluster->openBucket('beer-sample'); //we use a simple form of search: $query = CouchbaseSearchQuery::match('national'); //we fire the search and look at results $result = $bucket->query(new CouchbaseSearchQuery('beerIndex', $query)); printf("score id\n----------------------------\n"); foreach ($result->hits as $row) { printf("%f %s\n", $row->score, $row->id); } printf("----------------------------\n"); printf("total hits: %d\n", $result->metrics['total_hits']); |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
~ $ php search.php score id ---------------------------- 0.574057 penn_brewery-penn_marzen 0.542845 penn_brewery-penn_oktoberfest 0.536256 chelsea_brewing_company 0.529263 bluegrass_brewing_company_inc 0.528675 labatt_ontario_breweries-labatt_extra_dry 0.489116 rahr_sons_brewing_company-iron_thistle 0.474812 pabst_brewing_company 0.451381 rogue_ales-dad_s_little_helper 0.447907 pabst_brewing_company-lone_star 0.442591 great_divide_brewing-denver_pale_ale_dpa ---------------------------- total hits: 17 |
더 많은 예시 찾기 SDK에서 검색하기.
릴리스 받기
이 릴리스를 설치하려면 다음 명령을 사용하고 libcouchbase 2.6.1+가 설치되어 있는지 확인하세요(자세한 내용은 다음 링크에서 확인하세요. SDK 사용 시작하기 페이지):
|
1 2 |
pecl install couchbase-2.2.0 |
문제가 발생하면 다음 주소의 카우치베이스 포럼에 직접 게시해 주세요. https://www.couchbase.com/forums/c/php-sdk/. 또한 버그를 직접 보고할 수 있습니다. 이슈 추적기.