Ejemplo n.º 1
0
 /// <summary>
 /// Ensures that full text searching is enabled and the catalog exists
 /// </summary>
 /// <returns>True if the catalog exists, false otherwise.</returns>
 public static bool EnsureCatalog()
 {
     if (!KeywordSearchHelper.IsFullTextSearchEnabled())
     {
         KeywordSearchHelper.EnableFullTextSearch();
     }
     if (!KeywordSearchHelper.CatalogExists())
     {
         KeywordSearchHelper.CreateCatalog();
     }
     return(KeywordSearchHelper.CatalogExists());
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes the catalog
        /// </summary>
        public static void RemoveCatalog()
        {
            if (KeywordSearchHelper.CatalogExists())
            {
                // ATTEMPT TO REMOVE INDEXES IN THE CATALOG
                RemoveIndexes();

                // ATTEMPT TO REMOVE THE CATALOG, FAILURE IS NOT FATAL
                try
                {
                    Database  database = Token.Instance.Database;
                    DbCommand command  = database.GetSqlStringCommand("DROP FULLTEXT CATALOG " + FTSCatalogName);
                    database.ExecuteNonQuery(command);
                }
                catch (SqlException se)
                {
                    Logger.Warn("Could not remove fulltext catalog " + FTSCatalogName, se);
                }
            }
        }