A Simple Search Application for Alchemy

One of my students this week asked about creating an extremely simple search client for Alchemy. Out of the box, Alchemy Search can be fairly easy to use, but there are still a lot of buttons that one could press. And if all you want is a simple search to show all the documents across all your repositories it may be a bit too much. So I created what has to be one of the simplest UIs possible:

As you type in the search box at the top left, results start showing up in the list below:

Then you just click on a document and you get a preview:

You can continue typing and your search is refined. No need to press enter. So how did I get here? Well, its just a simple Windows form application with a SplitContainer. On the right side I have the Alchemy Viewer, and on the left is a text box and a listbox. Whenever the text in the text box changes, it does the search again. One of the benefits of Alchemy is that the search is extremely quick, so this app is amazingly quick.

When I do the search I have to ensure that the text doesn’t end with and or or. If it does, then don’t pass it to the search because those are keywords we use. Then I clear the textbox and clear the query. The search itself is easy:

auQuery.AddFullTextQuery(tbSearch.Text);
auQuery.SearchGroup(auSGroup);
if (auQuery.Results.Count > 0)
{
    foreach (Alchemy.Result aResult in auQuery.Results)
    {
        foreach (Alchemy.Item aItem in aResult.Items)
        {
            lbResults.Items.Add(aItem.Title);
        }
    }
}

This also populates the listbox. Then when I click on an item, I tell the Viewer to ViewItem(). It took all of 20 minutes to write ugly code while exhausted. Give me another 30 minutes to clean it up and I might be willing to share it. Of course, this assumes you have Alchemy.