Share via


What Is a Full-Text Catalog?

The catalog system uses SQL Server full-text catalogs to store and search catalog content. The system creates a full-text catalog for every catalog.

The free-text catalog contains the properties that are free-text searchable. To designate a property as free-text searchable, set the IsFreeTextSearchable property of the Information property on the CatalogProperty object to true.

You must regenerate the full-text index whenever you create new content or change existing content in a catalog. Commerce Server Core Systems uses change tracking with manual updates. All changes to searchable properties are tracked and updated when you regenerate the catalog index. To do this, use one of the RegenerateFullTextIndexes methods on the ProductCatalog object.

How to Get the Status of a Full-text Catalog

This example shows how to check the status of a full text catalog. To compile this code, include references to System.Data.SQLClient. You must also include the connection string. To find this string, open the Commerce Server Manager. In the left-side pane go to Console Root\Commerce Server Manager\Commerce Sites\StarterSite\Site Resources\Product Catalog. The connection string is the value of property CatalogDatabase in the right-side pane.

const int NoFullTextCatalog = -1;
static void Main(string[] args)
{
    string catalogName = "Adventure Works Catalog";
    string connectionString = "Connection string to catalog database";

    int fullTextStatus = GetFullTextStatus(catalogName, connectionString);
    switch (fullTextStatus)
    {
         case NoFullTextCatalog:
             break;
         case 0:  // Idle.
             break;
         case 1:  // Full population in progress.
             break;
         case 6:  // Incremental population in progress.
             break;
         case 9:  // Change tracking.
             break;
    }
}

const string Status = "Status";
public static int GetFullTextStatus(string catalogName, string connectionString)
{
    string commandText = "SELECT CatalogName, FullTextCatalog, FullTextCatalogProperty([FullTextCatalog], 'populatestatus') AS Status FROM dbo.CatalogGlobal";
    if (catalogName != null)
        commandText = commandText + string.Format(" WHERE CatalogName='{0}'", catalogName);
    using (SqlDataAdapter dataAdapter = new SqlDataAdapter(commandText, connectionString))
    {
         DataSet ds = new DataSet();
         dataAdapter.Fill(ds);
         if (ds.Tables[0].Rows.Count == 0)
             return NoFullTextCatalog;
         return ds.Tables[0][Status];
     }
}

See Also

Other Resources

How to Perform a Guided Search [API]