In the second quarter of 2016 BizStream launched Compare for Kentico, part of the BizStream Toolkit, a suite of add-ons for Kentico developers. Today I'm proud to review the second tool of the toolkit, Search for Kentico.
The goal for Search for Kentico is to be able to easily search across every object in your Kentico instance. If you search for a term like "console.log", our tool will look through every piece of code you have in your website, on the filesystem, as well as every database object that Kentico knows about (and doesn't know about) and return you intelligent results.
This is a very useful feature in case you want to check for debug statements, look out for dev URLs in content or email templates, or rename a column or SQL View name in the database. Now instead of waiting for some dependent object to possibly error, you can move on with confidence that your rename worked. Keep reading after the jump to find out how this free tool works.
How the Heck Does it Actually Work?
Search for Kentico is packaged up and delivered as a custom Kentico module. You can download the BizStream Toolkit right now and start using Search today for free (and we promise it will always be free). Once you have it downloaded you can continue on to the installation instructions. Basically the general idea is to import the module into your Kentico instance just like any other custom module. As of now the module works on Kentico 8.2 and Kentico 9.0.
The module will then be available to you in the Kentico main menu, and you can even make a Live Tile on the Kentico Dashboard if you want. When you query for a term, we use a combination of C# code, Kentico API scripts, and SQL scripts to scour the application and bring back any terms that match into a results grid. It's surprisingly pretty fast, even with lots of content. I still don't recommend searching through 10k or 100k pages at once if you have a very large site. We have filter options for that coming though.
I think at this point it might also makes sense to talk about the inspiration for this tool. The real truth is that developers, including myself, tend to be lazy. Come on, admit it, if you are reading this far, you can relate with the fact that copying and pasting a custom module loader, or custom transformation method is sure a hell of a lot easier than remembering the syntax from scratch. Honestly, we just got tired of looking at each other and saying, "Damn, I know I have written that event handler before...somewhere... six months ago..." and not being able to actually find the right code file in the right repository. So we did something about it. And we think it is worth sharing with the entire Kentico developer community.
Now we have a tool that can search any site's code and Kentico database objects. And we can finally be lazy again! Now any frequent reader of this blog knows I am kidding. But there situation is still 100% true.
What Does Search for Kentico Do Exactly?
Once you have it up and running, the user interface looks like the below screen shot. It's a simple interface with two standard vertical tabs. The first tab, Search, allows you to enter a term and find that term across a selected site. The second tab, Sites, allows you to add sites to search through. Remember you can add more than one site to the tool by installing agents in other Kentico instances. Then this module can communicate with more than one site at a time. This is where the power really comes in, like I mentioned above.
As you can see, we have a basic interface that allows you to choose which objects to search within based on what you want to search for in the system. Results are presented by what has the most "intelligent" matches. Don't ask me for the actual algorithm, that is a trade secret! But seriously, we did try to make it a smart matching system. Some objects have a higher weight than others, this is based on our experience with developing Kentico sites and what developers are looking for most.
The results grid itself is pictured below. Make sure you click the image below to look at the larger version. This screen shot really illustrates all of the cool things that our Search for Kentico tool tells you, like the number of matches inside of the result, what type of object that the result was found in, the nice name of the object, and a handy view action button to actually see the item.
Being able to quickly jump to the item and view its details is one of my favorite parts of the system. In the single results view modal window we actually show you the search term highlighted. You can also easily toggle back and forth between the number of matches using the Previous item and Next item buttons (or keyboard left and right arrows).
Right now the tool only does a Search, but in future versions we plan on looking into adding replace functionality. But as you might guess that gets a bit tricky to pull off. Plus what if you make a change to an object and forget to commit that change or push the staging task to promote the change to a QA site? Your sites could quickly become out of sync. If only there was a tool that could visually compare two Kentico sites at once...
We hope you find this developer tool for Kentico useful. If you do, please let us know! So what are you waiting for? Go download Search for Kentico and start being lazy again.