라이브러리

[PHP] SolrDocument::__unset - 문서에서 필드를 제거합니다.




PHP에서 SolrDocument::__unset()


SolrDocument는 Apache Solr의 PHP 클라이언트인 Zend Search Lucene의 일부입니다. SolrDocument는 Solr의 문서를 나타내는 클래스로, 문서의 필드에 접근하고 수정할 수 있습니다.

SolrDocument::__unset() 메서드는 특정 필드를 삭제하는 데 사용됩니다. 이 메서드는 문서의 필드를 삭제할 때 사용됩니다.

예제


#hostingforum.kr
php

use ZendSearchLuceneDocumentDocument;

use ZendSearchLuceneDocumentField;



// SolrDocument 인스턴스 생성

$document = new Document();



// 필드 추가

$document->addField(Field::String('name', 'John Doe'));

$document->addField(Field::String('age', '30'));

$document->addField(Field::String('city', 'Seoul'));



// 필드 삭제

$document->__unset('age');



// 필드 목록 출력

print_r($document->getFieldNames());



// 결과

// Array

// (

//     [0] => name

//     [1] => city

// )



__unset() 메서드의 사용법


SolrDocument::__unset() 메서드는 다음과 같이 사용할 수 있습니다.

#hostingforum.kr
php

$document->__unset('필드명');



* `필드명`은 삭제할 필드의 이름입니다.

필드 삭제 후의 문서 상태


필드를 삭제한 후, 문서의 상태는 다음과 같습니다.

* 삭제된 필드는 문서에서 제거됩니다.
* 문서의 필드 목록은 삭제된 필드를 제외한 필드만 포함됩니다.

참고


SolrDocument::__unset() 메서드는 문서의 필드를 삭제할 때 사용됩니다. 이 메서드는 문서의 필드를 삭제할 때 사용해야 합니다.
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 8,985건 / 165 페이지

검색

게시물 검색