2013-11-27 3 views
4

나는 Solrj와 원자 업데이 트를 사용하고 있습니다. 완벽하게 작동하지만 기존 문서 내의 필드를 삭제하는 방법을 모르겠습니다. SOLR 튜토리얼 (http://wiki.apache.org/solr/UpdateXmlMessages)에서 solrj 원자 업데이트 - null로 필드를 설정하는 방법?

들이는 XML로 작업을 수행하는 방법을 설명합니다

<add> 
    <doc> 
    <field name="employeeId">05991</field> 
    <field name="skills" update="set" null="true" /> 
    </doc> 
</add> 

사람은 SolrJ에서 작업을 수행하는 방법을 알고 있습니까?

감사합니다.

+0

확인 http://stackoverflow.com/questions/16234045/solr-how-to-use-the-new-field-update-modes-atomic-updates-with-solrj이 도움이 있습니다. – Nikolay

답변

4

좋아. 그래서 분명히 이렇게하는 방법입니다 -

SolrInputDocument inputDoc = new SolrInputDocument(); 

    Map<String, String> partialUpdateNull = new HashMap<String, String>(); 
    partialUpdateNull.put("set", null); 

    inputDoc.setField("FIELD_YOU_WANT_TO_DELETE", partialUpdateNull); 

고마워요!

관련 문제