2013-12-10 58 views
0

我們如何使用Oracle UCM上的collectionId進行全文搜索?是否有可能做全文搜索遞歸地提供collectionId參數開始? 我做了一些試驗(你可以看看下面),但如果我用collectionId測試,沒有結果返回。如何使用Oracle UCM上的collectionId進行全文搜索?

public List<UCMDocumentTemplate> fullTextSearchByFolderId(@WebParam(name = "searchCriteria") 
    String paramSearchCriteria, @WebParam(name = "ucmFolderId") 
    Long ucmFolderId) throws UCMDocumentSearchException 
{ 
    List<UCMDocumentTemplate> documentTemplateList = new ArrayList<UCMDocumentTemplate>(); 
    String documentSearchCriteria = ""; 
    try 
    { 
     if (ucmFolderId != null) 
      documentSearchCriteria = "xCollectionID <= <qsch>" + ucmFolderId + "</qsch> <AND>"; 
     documentSearchCriteria += "dDocFullText <substring> <qsch>" + paramSearchCriteria + "</qsch>"; 
     List<Properties> childDocumentList = UCM_API.fullTextSearch(documentSearchCriteria); 
     UCMDocumentTemplate ucmDocumentTemplate = null; 
     if (childDocumentList != null) 
      for (Properties properties : childDocumentList) 
      { 
       ucmDocumentTemplate = transformToUCMDocumentTemplate(new UCMDocumentTemplate(), properties); 
       documentTemplateList.add(ucmDocumentTemplate); 
      } 
    } 
    catch (Exception e) 
    { 
     UCMDocumentSearchException exc = new UCMDocumentSearchException(documentSearchCriteria, e); 
     System.err.println(exc.getCompleteCode()); 
     e.printStackTrace(); 
     throw exc; 
    } 
    return documentTemplateList; 
} 

public static List<Properties> fullTextSearch(String searchCriteria) throws Exception 
{ 
List<Properties> resultList = null; 
List<Field> fields = null; 
Properties responseProperties = null; 

Properties inputBinderProperties = new Properties(); 
inputBinderProperties.put("IdcService", "GET_SEARCH_RESULTS"); 
inputBinderProperties.put("QueryText", searchCriteria); 
inputBinderProperties.put("SearchEngineName", "databasefulltext"); 
inputBinderProperties.put("ResultCount", "500"); 

DataBinder responseBinder = getExecutedResponseBinder(userName, inputBinderProperties); 
DataResultSet resultSet = responseBinder.getResultSet("SearchResults"); 

fields = resultSet.getFields(); 
resultList = new ArrayList<Properties>(); 
for (DataObject dataObject : resultSet.getRows()) 
{ 
    responseProperties = new Properties(); 
    for (Field field : fields) 
    { 
     if (field.getType() == Field.Type.DATE && dataObject.getDate(field.getName()) != null) 
      responseProperties.put(field.getName(), dataObject.getDate(field.getName())); 
     else 
      responseProperties.put(field.getName(), dataObject.get(field.getName())); 
    } 
    resultList.add(responseProperties); 
} 

return resultList; 

}

回答

0

我發現了一個解決方案。當向inputBinderProperties添加參數時,它可以正常工作

inputBinderProperties.put("folderChildren", ucmFolderId); 
相關問題