IBM FileNet P8, Version 5.2.1            

Retrieving the Background Search Results

The following Java™ and C# code examples demonstrate how to retrieve background search results by retrieving CmAbstractSearchResult objects.

Java Example

// Retrieve the CmAbstractSearchResult objects that are associated with the background search.
CmAbstractSearchResultSet objBkSearchResults = objBkSearch.get_SearchResults();

// Iterate search results.
Iterator iter = objBkSearchResults.iterator();
while (iter.hasNext())
{
    CmAbstractSearchResult objBkSearchResult = (CmAbstractSearchResult) iter.next();

    // Iterate properties of each search result.
    Properties props = objBkSearchResult.getProperties();
    Iterator iterProps = props.iterator();
    while (iterProps.hasNext() )
    {
        Property prop = (Property)iterProps.next();

        // Search for DocCreationDate property of each result object and print non-null values.
        if (prop.getPropertyName().equalsIgnoreCase("DocCreationDate"))
        {
            if ( prop.getObjectValue() != null )
                System.out.print("\nDocCreationDate property value: " + prop.getObjectValue().toString());
        }
    }
}

C# Example

// Retrieve the CmAbstractSearchResult objects that are associated with the background search.
ICmAbstractSearchResultSet objBKSearchResults = objBkSearch.SearchResults;

// Iterate search results.
foreach (ICmAbstractSearchResult objBkSearchResult in objBKSearchResults)
{
    // Iterate properties of each search result.
    IProperties props = objBkSearchResult.Properties;
    foreach (IProperty prop in props)
    {
        // Search for DocCreationDate property of each result object and print non-null values.
        if (prop.GetPropertyName().Equals("DocCreationDate"))
        {
            if ( prop.GetObjectValue() != null)
                System.Console.Write("\nDocCreationDate property value: " + prop.GetObjectValue().ToString());
        }
    }
}


Last updated: October 2015
backgroundsearch_snip4.htm

© Copyright IBM Corporation 2015.