2016-06-02 1 views
0

MarkLogic에서 문서를 삽입해야한다면 Java API를 사용하여 문서를 저장할 포리스트를 어떻게 지정할 수 있습니까? 여기 marklogic에서 문서를 삽입/가져 오는 동안 포리스트 지정

내가 MarkLogic 데이터베이스에 데이터를 기록하는 예이다 : 나는 숲을 지정하여 문서를 저장할 수있는 경우

// create the client 
DatabaseClient client = DatabaseClientFactory.newClient(
    props.host, props.port, props.writerUser, props.writerPassword, 
    props.authType); 

// make use of the client connection 
TextDocumentManager docMgr = client.newTextDocumentManager(); 
String docId = "/example/text.txt"; 
StringHandle handle = new StringHandle(); 
handle.set("A simple text document"); 
docMgr.write(docId, handle); 

, 그때 나는 또한 지정된 숲과 문서를 가져올 필요가있다.

XQuery에서 특정 포리스트 ID 내에서 저장 및 검색을했기 때문에 가능하다고 생각합니다. 그래서 같이 : 특정 숲으로

삽입 :

xdmp:document-insert(
    $uri as xs:string,$root as node(), 
    [$permissions as element(sec:permission)*], [$collections as xs:string*],  
    [$quality as xs:int?], [$forest-ids as xs:unsignedLong*]) 
as empty-sequence() 

숲에 특정 검색 -

cts:search(
    $expression as node()*, $query as cts:query?, 
    [$options as (cts:order|xs:string)*], [$quality-weight as xs:double?], 
    [$forest-ids as xs:unsignedLong*]) as node()* 

나 자바 API에서이 작업을 수행하는 방법을 알려 주시기 바랍니다.

답변

1

오늘은 Java 클라이언트 API를 통해 사용할 수 없습니다. MarkLogic 9에서 사용할 수 있습니다. MarkLogic 9의 조기 액세스 버전에서 사용해 보려면 early access program에 가입하십시오. 이 기능을 사용해 본 후에 의견을 보내주십시오.

MarkLogic 9에서 당신은 DatabaseClientFactory에 ForestName을 지정하여이 작업을 수행 할 수 있습니다

DatabaseClient client = DatabaseClientFactory.newClient(
    props.host, props.port, props.writerUser, props.writerPassword, 
    props.authType, props.forestName); 

그런 다음 그 숲과 검색에 기록됩니다 작성된 문서는 해당 포리스트 내의 일치합니다.

+0

정보를 제공해 주셔서 감사합니다. – RCS

관련 문제