如何在Oracle UCM上使用collectionId进行全文搜索?

时间:2013-12-10 11:44:48

标签: java oracle-ucm

我们如何在Oracle UCM上使用collectionId进行全文搜索?是否可以通过collectionId参数以递归方式启动全文搜索? 我做了一些试验(你可以看看下面),但如果我用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;

}

1 个答案:

答案 0 :(得分:0)

我找到了解决方案。将参数添加到inputBinderProperties时,它可以正常工作

    inputBinderProperties.put("folderChildren", ucmFolderId);