라이브러리
[PHP] SolrQuery::removeExpandFilterQuery - 확장 필터 쿼리를 제거합니다.
SolrQuery::removeExpandFilterQuery
SolrQuery는 PHP의 Solr 라이브러리에 포함된 클래스로, Solr 쿼리를 생성하고 관리하는 데 사용됩니다. `removeExpandFilterQuery` 메소드는 쿼리에서 확장 필터 쿼리를 제거하는 데 사용됩니다.
확장 필터 쿼리
확장 필터 쿼리는 쿼리에서 필터링을 위해 사용되는 쿼리입니다. 예를 들어, `q=apple AND price:10` 쿼리에서 `price:10`은 확장 필터 쿼리입니다.
삭제 확장 필터 쿼리
`removeExpandFilterQuery` 메소드는 쿼리에서 확장 필터 쿼리를 제거합니다. 예를 들어, `q=apple AND price:10` 쿼리에서 `price:10` 확장 필터 쿼리를 제거하면 `q=apple` 쿼리가 됩니다.
예제
#hostingforum.kr
php
use SolariumClient;
use SolariumQueryTypeQuery;
// Solr 클라이언트 생성
$client = new Client($config);
// 쿼리 생성
$query = $client->createUpdateQuery();
$query->setQuery('q=apple AND price:10');
// 확장 필터 쿼리 제거
$query->removeExpandFilterQuery('price:10');
// 쿼리 실행
$result = $client->execute($query);
// 결과 출력
print_r($result);
결과
쿼리 실행 후 결과는 다음과 같습니다.
#hostingforum.kr
php
Array
(
[responseHeader] => Array
(
[status] => 0
[QTime] => 1
[params] => Array
(
[version] => 1.6
[start] => 0
[rows] => 10
[q] => apple
[wt] => json
)
)
[response] => Array
(
[numFound] => 12
[start] => 0
[docs] => Array
(
[0] => Array
(
[id] => 1
[name] => Apple
[price] => 10
)
[1] => Array
(
[id] => 2
[name] => Banana
[price] => 5
)
[2] => Array
(
[id] => 3
[name] => Orange
[price] => 15
)
[3] => Array
(
[id] => 4
[name] => Grape
[price] => 20
)
[4] => Array
(
[id] => 5
[name] => Pear
[price] => 10
)
[5] => Array
(
[id] => 6
[name] => Peach
[price] => 15
)
[6] => Array
(
[id] => 7
[name] => Cherry
[price] => 20
)
[7] => Array
(
[id] => 8
[name] => Plum
[price] => 10
)
[8] => Array
(
[id] => 9
[name] => Apricot
[price] => 15
)
[9] => Array
(
[id] => 10
[name] => Nectarine
[price] => 20
)
[10] => Array
(
[id] => 11
[name] => Pomegranate
[price] => 25
)
[11] => Array
(
[id] => 12
[name] => Kiwi
[price] => 30
)
)
)
)
쿼리에서 확장 필터 쿼리를 제거한 결과는 `apple` 쿼리만으로 필터링된 결과가 나옵니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.