updating the Full text catalog programatically in SQL server (thru job or trigger)?

cebuhax0r 66 Reputation points
2022-12-21T15:11:07.897+00:00

We need to update the indexes by rebuilding the full text catalog for a frequently for our search to work.
right now as we are in development we just do manual rebuild of the catalag in Management Studio.

but we want to do it programatically, so what are our options?
We are planning to launch a job that rebuild the full text catalog every N minutes or something.
Is this a good approach?

or I am planning to have a trigger that triggers the rebuild of catalog when an insert happened.

but first, i want to know

  1. How can I rebuild the Full Text catalog programatically so I can do it in a trigger or in a job.
  2. Is there any resource or tutorial on how to rebuild the full text catalog or indexes in a job or a trigger?

Lastly, what are my other options aside from doing it in trigger or job?

SQL Server Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2022-12-21T22:31:39.96+00:00

    It's not clear to me why you would need to do this. The default when you create a fulltext index is CHANGE_TRACKING = AUTO, which means that SQL Server will update the index automatically.

    Observe though, that in difference to regular indexes, fulltext indexes are updated asynchronously, so changes are not visible immediately, but there can be a delay.


  2. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2022-12-22T22:35:10.077+00:00

    Beware the the change-tracking setting is per index, not per fulltext catalog.

    You can view the setting for for all fulltext indexes with this query:

       SELECT object_name(object_id), * FROM sys.fulltext_indexes  
    

    This view also includes the column is_crawl_completed, which tells if an update is in progress or not.

    I don't the full story on how often a crawl starts and when it completes, but it should be more than once a day.

    And it should not make that much difference if it is Express Edition.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.