You are here

You are here

Finding a Folder by Attributes or Name

A search can be done on a folder name and the same parameters that are available through the SpringCM user interface search are available in this method.

This method will return multiple results if several folders match the search criteria.  Whether single or multiple results are found an SCMFolder array is always returned from this call.

The search API call allows developers to build custom search widgets that can be used as “views” into folders in SpringCM.  Generally, the capabilities of Search via the API are the same as what is provided by the SpringCM advanced search screen.  SpringCM recommends the newer FolderPagedSearch method be used over the FolderSearch method that does not allow paging and can be slower.

With either method, an SCMSearchFolder document is used to describe the parameters of the search.  The following describes the FolderPagedSearch method and SCMSearchFolder object.

FolderPagedSearch

Inputs

  • token – Authentication token used in all SOAP calls
  • search – An instance of an SCMSearchFolder that defines the search to run
  • loadExtendedMetadata – Whether metadata on the folder is loaded, should generally return false if the metadata is not needed for improve performance.

Output

The return value is an SCMFolderResult with 5 properties:

  • DocResults – An array of documents returned by the search
  • FolderResults – An array of folders returned by the search
  • NativeHitCount – Overall number of hits on the query
  • QueriedMaxHits – Current max hit index
  • ThereMayBeMoreHits – Specifies if there are more hits

SCMSearchFolder Object

  • AtLeastOneWord – Searches full text for at least one word in a list of words
  • EndDate – Used in conjunction with StartDate to filter on modified dates
  • LimitFolderId – Folder id to which search can be limited
  • LimitIncludeSubfolders – If LimitFolderId is set, specifies if the search should include its subfolders
  • MaxHits – How many items to return
  • StartDate – Used in conjunction with EndDate to filter on modified dates
  • StartHitIndex – Index to start from when paging through results
  • WithAllWords – Searches full text for documents with all words listed
  • WithoutWords – Searches full text for documents without the words listed
  • WithPhrase – Searches full text for documents with the given phrase

Vertical Tabs

c#
var searchFolder = new SCMSearchFolder {WithAllWords = "Quarterly Reports", StartHitIndex = 0, MaxHits = 100};
 
SCMSearchResult result;
var returnList = new List<SCMFolder>();
do
{
	result = springCMService.FolderPagedSearch(token, searchFolder, false);
	returnList.AddRange(result.FolderResults);
	searchFolder.StartHitIndex += searchFolder.MaxHits;
} while (result.ThereMayBeMoreHits);
 
Console.WriteLine("{0} documents found by the search.", returnList.Count);
java
SCMSearchFolder searchFolder = new SCMSearchFolder();
 
searchFolder.setWithAllWords("Quarterly Reports");
searchFolder.setStartHitIndex(0);                        
searchFolder.setMaxHits(100);
 
Calendar c = Calendar.getInstance();
c.set(1900,1, 1);
searchFolder.setStartDate(c);
searchFolder.setEndDate(Calendar.getInstance());
 
 
SCMSearchResult result;
ArrayList<SCMFolder> returnList = new ArrayList<SCMFolder>();
 
do
{
	result = springCMService.folderPagedSearch(token, searchFolder,false);
	returnList.addAll(Arrays.asList(result.getFolderResults()));
	searchFolder.setStartHitIndex(searchFolder.getStartHitIndex() + searchFolder.getMaxHits());
} while (result.isThereMayBeMoreHits());
 
System.out.format("%s folders found by the search.\n",returnList.size());