Hello,
I'm writing a custom java code to search some documents in a knowloedge space.
The problem is that when I run the search I always get a result with 0 documents. If I run the same query from the advanced search in the Web Client I get the correct result.
In my Java code I'm setting the same profile condition used by the web interface.
Here is my java code:
String mpLibraryName = cfg_prc.getProperty("LIBRARY");
String mpWorkSpaceId = cfg_prc.getProperty("WORKSPACE_ID");
mpLibrary = mpSession.getLibraryByName(mpLibraryName);
String docTypeCondition = "APP:
ATASOURCE=\"" + cfg_prc.getProperty("WSMP_DOC_TYPE") + "\"";
String profileCondition = "(" + cfg_prc.getProperty("PROFILE_CONDITION") + ") AND (" + docTypeCondition + ")";
//String profileCondition = cfg_prc.getProperty("PROFILE_CONDITION");
logger.debug("Using profile condition [" + profileCondition + "]");
WorkspaceSearchArgument wsa = new WorkspaceSearchArgument();
wsa.setProfileCondition(profileCondition);
SearchArgument.SearchReturnedItem[] returnedItems = new SearchArgument.SearchReturnedItem[1];
String[] returnedProperties = new String[28];
returnedProperties[11] = "EXT:
ATA";
returnedProperties[26] = "EXT::TIPOSPOOL_RSID";
returnedProperties[27] = "APP:
ATASOURCE";
Class itemClass = com.imanage.cms.api.workteam.Document.class;
SearchArgument.SearchReturnedItem returnedItem = new SearchArgument.SearchReturnedItem(itemClass, returnedProperties);
returnedItems[0] = returnedItem;
wsa.setReturnedItems(returnedItems);
Catalog ks = (Catalog) mpLibrary.getObjectById(mpWorkSpaceId);
SearchResultList srl = ks.search(wsa);
totalDocuments = srl.size();
mpDocList = srl.iterator();
Here is the profile condition I'm using:
((EXT:
ATA > #2005-1-1 00:00:00# AND EXT:
ATA < #2005-2-1 00:00:00# ) AND ( EXT::TIPOSPOOL_RSID IN (100) )) AND (APP:
ATASOURCE="extMfarchivio")
Is there anyone that can help with this?
Thanks!