라이브러리
[PHP] SolrDocumentField::__construct - 생성자
SolrDocumentField::__construct
SolrDocumentField는 Solr에서 사용되는 필드 클래스로, SolrDocument에 포함되어 사용됩니다. SolrDocument은 SOLR에서 사용되는 문서 클래스로, 문서의 필드 값을 저장하고 관리하는 역할을 합니다.
SolrDocumentField::__construct는 SolrDocumentField 클래스의 생성자 메소드로, 필드의 이름과 타입을 지정하는 역할을 합니다.
생성자 메소드
SolrDocumentField::__construct의 생성자 메소드는 다음과 같습니다.
#hostingforum.kr
php
public function __construct($name, $type = self::STRING, $multiValued = false, $stored = true, $indexed = true, $tokenized = false, $termVector = false, $termVectorsEnhanced = false, $termPositions = false, $termFreqs = false, $docValues = false, $docValuesType = null, $docValuesDimensions = null)
매개변수 설명
- `$name`: 필드의 이름
- `$type`: 필드의 타입 (기본값: `self::STRING`)
- `$multiValued`: 필드가 다중 값일 때 true, 아닐 때 false (기본값: `false`)
- `$stored`: 필드가 저장될 때 true, 아닐 때 false (기본값: `true`)
- `$indexed`: 필드가 색인될 때 true, 아닐 때 false (기본값: `true`)
- `$tokenized`: 필드가 토큰화될 때 true, 아닐 때 false (기본값: `false`)
- `$termVector`: 필드가 용어 벡터로 저장될 때 true, 아닐 때 false (기본값: `false`)
- `$termVectorsEnhanced`: 필드가 용어 벡터를 향상 시킬 때 true, 아닐 때 false (기본값: `false`)
- `$termPositions`: 필드가 용어 위치를 저장할 때 true, 아닐 때 false (기본값: `false`)
- `$termFreqs`: 필드가 용어 빈도수를 저장할 때 true, 아닐 때 false (기본값: `false`)
- `$docValues`: 필드가 문서 값으로 저장될 때 true, 아닐 때 false (기본값: `false`)
- `$docValuesType`: 필드의 문서 값 타입 (기본값: `null`)
- `$docValuesDimensions`: 필드의 문서 값 차원 (기본값: `null`)
예제
#hostingforum.kr
php
use SolariumCoreQueryDocumentFieldText;
// 필드 생성
$textField = new Text('name', 'text', true, true, true);
// 필드 정보 출력
echo $textField->getName() . "
"; // name
echo $textField->getType() . "
"; // text
echo $textField->isMultiValued() ? 'true' : 'false' . "
"; // true
echo $textField->isStored() ? 'true' : 'false' . "
"; // true
echo $textField->isIndexed() ? 'true' : 'false' . "
"; // true
위 예제에서, `Text` 클래스는 `SolrDocumentField` 클래스를 상속하고, 생성자 메소드를 오버라이딩하여 필드의 이름, 타입, 다중 값 여부, 저장 여부, 색인 여부를 지정합니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.