
SolrQuery::getGroupFunctions 메서드는 그룹 함수를 적용하기 위해 사용됩니다. 이 메서드는 파라미터로 함수 이름과 필드를 지정하는 배열을 받습니다. 예를 들어, 'min' 함수를 사용하는 경우, 다음과 같이 파라미터를 전달할 수 있습니다.
#hostingforum.kr
php
$groupFunctions = array(
'min' => 'price'
);
이 경우, 'price' 필드의 최소값을 반환합니다.
getGroupFunctions 메서드는 그룹 함수를 적용한 결과를 반환합니다. 이 결과는 SolrQuery 객체의 결과와 동일한 형식으로 반환됩니다.
이 결과를 사용하여 그룹 함수를 적용할 수 있습니다. 예를 들어, 'min' 함수를 사용하여 price 필드의 최소값을 찾는 경우, 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
php
$query = new SolrQuery();
$query->getGroupFunctions(array('min' => 'price'));
$result = $query->execute();
foreach ($result->getGroupValue('min_price') as $doc) {
echo $doc['price'] . "n";
}
이 코드는 'price' 필드의 최소값을 찾은 후, 그 값을 출력합니다.
getGroupFunctions 메서드는 여러 그룹 함수를 적용할 수 있습니다. 예를 들어, 'min' 함수와 'max' 함수를 함께 사용하는 경우, 다음과 같이 파라미터를 전달할 수 있습니다.
#hostingforum.kr
php
$groupFunctions = array(
'min' => 'price',
'max' => 'price'
);
이 경우, 'price' 필드의 최소값과 최대값을 반환합니다.
이 결과를 사용하여 그룹 함수를 적용할 수 있습니다. 예를 들어, 'min' 함수와 'max' 함수를 사용하여 'price' 필드의 최소값과 최대값을 찾는 경우, 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
php
$query = new SolrQuery();
$query->getGroupFunctions(array('min' => 'price', 'max' => 'price'));
$result = $query->execute();
foreach ($result->getGroupValue('min_price') as $doc) {
echo $doc['price'] . "n";
}
foreach ($result->getGroupValue('max_price') as $doc) {
echo $doc['price'] . "n";
}
이 코드는 'price' 필드의 최소값과 최대값을 찾은 후, 그 값을 출력합니다.
getGroupFunctions 메서드는 여러 필드를 지정할 수 있습니다. 예를 들어, 'min' 함수를 사용하여 'price' 필드와 'quantity' 필드의 최소값을 찾는 경우, 다음과 같이 파라미터를 전달할 수 있습니다.
#hostingforum.kr
php
$groupFunctions = array(
'min' => array('price', 'quantity')
);
이 경우, 'price' 필드와 'quantity' 필드의 최소값을 반환합니다.
이 결과를 사용하여 그룹 함수를 적용할 수 있습니다. 예를 들어, 'min' 함수를 사용하여 'price' 필드와 'quantity' 필드의 최소값을 찾는 경우, 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
php
$query = new SolrQuery();
$query->getGroupFunctions(array('min' => array('price', 'quantity')));
$result = $query->execute();
foreach ($result->getGroupValue('min_price') as $doc) {
echo $doc['price'] . "n";
}
foreach ($result->getGroupValue('min_quantity') as $doc) {
echo $doc['quantity'] . "n";
}
이 코드는 'price' 필드와 'quantity' 필드의 최소값을 찾은 후, 그 값을 출력합니다.
getGroupFunctions 메서드는 여러 그룹 함수를 함께 사용할 수 있습니다. 예를 들어, 'min' 함수와 'max' 함수를 함께 사용하여 'price' 필드와 'quantity' 필드의 최소값과 최대값을 찾는 경우, 다음과 같이 파라미터를 전달할 수 있습니다.
#hostingforum.kr
php
$groupFunctions = array(
'min' => array('price', 'quantity'),
'max' => array('price', 'quantity')
);
이 경우, 'price' 필드와 'quantity' 필드의 최소값과 최대값을 반환합니다.
이 결과를 사용하여 그룹 함수를 적용할 수 있습니다. 예를 들어, 'min' 함수와 'max' 함수를 사용하여 'price' 필드와 'quantity' 필드의 최소값과 최대값을 찾는 경우, 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
php
$query = new SolrQuery();
$query->getGroupFunctions(array('min' => array('price', 'quantity'), 'max' => array('price', 'quantity')));
$result = $query->execute();
foreach ($result->getGroupValue('min_price') as $doc) {
echo $doc['price'] . "n";
}
foreach ($result->getGroupValue('max_price') as $doc) {
echo $doc['price'] . "n";
}
foreach ($result->getGroupValue('min_quantity') as $doc) {
echo $doc['quantity'] . "n";
}
foreach ($result->getGroupValue('max_quantity') as $doc) {
echo $doc['quantity'] . "n";
}
이 코드는 'price' 필드와 'quantity' 필드의 최소값과 최대값을 찾은 후, 그 값을 출력합니다.
getGroupFunctions 메서드는 여러 필드를 지정할 수 있습니다. 예를 들어, 'min' 함수를 사용하여 'price' 필드, 'quantity' 필드, 'discount' 필드의 최소값을 찾는 경우, 다음과 같이 파라미터를 전달할 수 있습니다.
#hostingforum.kr
php
$groupFunctions = array(
'min' => array('price', 'quantity', 'discount')
);
이 경우, 'price' 필드, 'quantity' 필드, 'discount' 필드의 최소값을 반환합니다.
이 결과를 사용하여 그룹 함수를 적용할 수 있습니다. 예를 들어, 'min' 함수를 사용하여 'price' 필드, 'quantity' 필드, 'discount' 필드의 최소값을 찾는 경우, 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
php
$query = new SolrQuery();
$query->getGroupFunctions(array('min' => array('price', 'quantity', 'discount')));
$result = $query->execute();
foreach ($result->getGroupValue('min_price') as $doc) {
echo $doc['price'] . "n";
}
foreach ($result->getGroupValue('min_quantity') as $doc) {
echo $doc['quantity'] . "n";
}
foreach ($result->getGroupValue('min_discount') as $doc) {
echo $doc['discount'] . "n";
}
이 코드는 'price' 필드, 'quantity' 필드, 'discount' 필드의 최소값을 찾은 후, 그 값을 출력합니다.
getGroupFunctions 메서드는 여러 그룹 함수를 함께 사용할 수 있습니다. 예를 들어, 'min' 함수와 'max' 함수를 함께 사용하여 'price' 필드, 'quantity' 필드, 'discount' 필드의 최소값과 최대값을 찾는 경우, 다음과 같이 파라미터를 전달할 수 있습니다.
#hostingforum.kr
php
$groupFunctions = array(
'min' => array('price', 'quantity', 'discount'),
'max' => array('price', 'quantity', 'discount')
);
이 경우, 'price' 필드, 'quantity' 필드, 'discount' 필드의 최소값과 최대값을 반환합니다.
이 결과를 사용하여 그룹 함수를 적용할 수 있습니다. 예를 들어, 'min' 함수와 'max' 함수를 사용하여 'price' 필드, 'quantity' 필드, 'discount' 필드의 최소값과 최대값을 찾는 경우, 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
php
$query = new SolrQuery();
$query->getGroupFunctions(array('min' => array('price', 'quantity', 'discount'), 'max' => array('price', 'quantity', 'discount')));
$result = $query->execute();
foreach ($result->getGroupValue('min_price') as $doc) {
echo $doc['price'] . "n";
}
foreach ($result->getGroupValue('max_price') as $doc) {
echo $doc['price'] . "n";
}
foreach ($result->getGroupValue('min_quantity') as $doc) {
echo $doc['quantity'] . "n";
}
foreach ($result->getGroupValue('max_quantity') as $doc) {
echo $doc['quantity'] . "n";
}
foreach ($result->getGroupValue('min_discount') as $doc) {
echo $doc['discount'] . "n";
}
foreach ($result->getGroupValue('max_discount') as $doc) {
echo $doc['discount'] . "n";
}
이 코드는 'price' 필드, 'quantity' 필드,
2025-04-28 05:25