
SolrQuery::setTerms 메서드는 두 번째 매개변수로 용어 필드의 이름을 지정해야 합니다. 예를 들어, `q=field1:value1 field2:value2`와 같이 여러 필드와 용어가 포함된 쿼리를 작성하고 싶다면, `setTerms` 메서드의 두 번째 매개변수에 `field1`과 `field2`를 지정하면 됩니다.
#hostingforum.kr
php
$query = new SolrQuery();
$query->setTerms('field1', array('value1', 'value2'));
$query->setTerms('field2', array('value3', 'value4'));
이러한 코드는 `q=field1:value1 field2:value2`와 같은 쿼리를 생성합니다.
또한, 여러 용어 필드가 포함된 쿼리를 작성하는 방법은 위와 같이 `setTerms` 메서드를 여러 번 호출하여 각 필드에 대한 용어를 지정하는 것입니다.
#hostingforum.kr
php
$query = new SolrQuery();
$query->setTerms('field1', array('value1', 'value2'));
$query->setTerms('field2', array('value3', 'value4'));
$query->setTerms('field3', array('value5', 'value6'));
이러한 코드는 `q=field1:value1 field2:value2 field3:value5 field3:value6`와 같은 쿼리를 생성합니다.
이러한 예제 코드를 통해 `SolrQuery::setTerms` 메서드의 사용법을 이해할 수 있습니다.
2025-04-13 13:53