Batch file to rebuild indexes and SearchData contents in Track-It!

Version 12
    Share This:

    Ok, so I was recently asked why we don't have an automated way to rebuild the SearchData and rebuild database indexes....


    Anyone who's worked with the newer Track-It! builds (Track-It! 8 and newer) knows that the SearchData contents sometimes need to be rebuilt.  You'll know this to be the case when you search for something in Track-It! and don't get the expected results.  We use a file-system based series of Search Indexes, and these sometimes need to be deleted and rebuilt, or your Tech Client searches may give you bad results.


    In conjunction with this, it's a good idea to rebuild the indexes within the database, because those database indexes are used to build the file system indexes.  Rebuilding database indexes typically leads to a significant improvement in performance as well.


    Some customers have found it beneficial to set up the SearchData rebuild and database index rebuild on a revolving schedule, anywhere from once a month to once every three or four months, depending on how heavily your system is used.  However, historically they've had to come up with their own process, because we didn't have anything built to do this.


    I was able to build a batch file that will simplify this process for you.  It should reside on the Track-It! sever.  (Where on the Track-It! server doesn't really matter for the batch file, so you can put it anywhere that's convenient.)  Double click it to run it; it presents a brief description and the option to abort (in case someone launched it by mistake).  If you choose to continue, it stops the Track-It! service, deletes the contents of SearchData, rebuilds database indexes, and then starts the service back.  It alerts you if anything goes wrong.


    Feel free to give it a try, and give me any input or suggestions for improvement.  I'm debating making a completely silent version of it for use with Windows Task Scheduler or similar, so that it can be used in "unattended mode" (no user prompting or input).  However, if I make a completely silent one like that, I have to include physical logging so that results can be recorded for later review.





    11/21/2014, updated the batch files.  Now both will check for the existence of LastDBChangelogID.txt as an indicator that the Search Data rebuild completed (prior to this, they simply reported completion when the DB reindexes were completed).  Both files will now take longer to complete.  Both will print on-screen updates, and the unattended version will update the log as well.  Both let you know when you can resume use of Track-It!.



    01/20/2015, updated batch files to check for location of SearchData rather than trusting that the location is the default.



    03/21/2016  We've seen a number of systems that take a excessively long amount of time (days and days) for the SearchData rebuild to complete.  In some cases, it never seems to complete at all.  We have a defect logged for this, and we're looking into it.  I'm under the impression that there's a disk I/O bottleneck somewhere on the systems that exhibit this behavior, because in most cases I can get the database here, and on my little test VM system, complete the rebuild in a few hours (usually less than 3).  Regardless, the prior versions of these batch files deleted the original SearchData when the process began, in order to build clean new SearchData from newly rebuilt database indexes.  I've updated the batch files to NOT delete the original SearchData, but to rename it to SearchData.ARCHIVE.  Then, when the process completes successfully, it should delete SearchData.ARCHIVE.  If you find that it's taking an inordinate amount of time to complete the rebuild, you can kill the batch file; delete the incomplete SearchData folder; and rename SearchData.ARCHIVE to SearchData, to restore operation.







    When running these on a Track-It! 11.4 system that has had SP1 applied, the database re-indexing portion is failing.  The function that does the DB re-index is unable to log in because of an enhanced security implementation that is part of SP1.  The corrective action for Track-It! 11.4 systems with SP1 is to replace two Track-It! DLLs.  The replacement DLLs and instructions are contained in the attached Zip file.  These are only necessary, and will only function as expected, on Track-It! 11.4 with SP1.




    02/22/2018 If you are using Track-It! 11.4 SP1 Respin 1 then you need not replace the DLL files mentioned in the attachments. Simply run the TIReindex.bat file on the application server.