Skip to content

Support/Recommendation for Full Text Catalogs/Indexes #27

Description

@ronnieoverby

Insight doesn't natively support the full text catalog/index types. So I thought I'd do something like:

-- SCRIPT [FullTextCatalog]
IF NOT EXISTS (
        SELECT *
        FROM sys.fulltext_catalogs
        WHERE NAME = 'FullTextCatalog1'
        )
    CREATE FULLTEXT CATALOG [FullTextCatalog1]

But, SQL server complains

Cannot create SQL object [FullTextCatalog]: CREATE FULLTEXT CATALOG statement cannot be used inside a user transaction.

My current workaround is to have this method execute previously ignored scripts after SchemaInstaller.Install:

// SchemaObjectCollection.Load is ignoring names like *.POSTEXEC.*

/// <summary>
/// Runs scripts after and outside of insight's installation process.
/// </summary>
private static void PostExecuteScripts(IDbConnection connection)
{
    var assembly = Assembly.GetExecutingAssembly();

    var scripts = assembly.GetManifestResourceNames()
        .Where(x => x.IndexOf(".POSTEXEC.", StringComparison.OrdinalIgnoreCase) != -1)
        .OrderBy(x => x)
        .Select(name =>
        {
            using (var stream = assembly.GetManifestResourceStream(name))
            using (var reader = new StreamReader(stream))
                return new {Name = name, SQL = reader.ReadToEnd()};
        });

    foreach (var script in scripts)
    {
        Console.WriteLine("Post Exec Script: "+ script.Name);
        connection.ExecuteSql(script.SQL);
    }
}

I'm wondering:

  • Do you have a better workaround for now?
  • Can Insight support full text search objects natively?
  • Must all --SCRIPT's run within a user transaction?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions