
Google has a tool for companies that consists in a server that craws all the information in the company and indexes it.
Today i passed all the afternoon playing (user perspective) with that little powerful thing.
The usage is simple. The machine is configure to have several types of indexes. So, when you request the information, the machine only returns the information about the specific thing you are searching for.
The Request is simple. Is a Http Request to the specified url were you pass, via query string, the information about your search (search key and several configuration parameters).
My implementation was very simple. A class, that i called it GSA (stands for Google Search Appliance
), with a method called Search. This method receives 3 parameters: the string to search, the start item and a filter parameter.
The filter is the more strange parameter here. It is used to return or the most relevant information, or all the results. The start item is the index of the first element that GSA must return( ie. Give me the elements starting at index 10). Finally the string to search… obvious…
When the Search method is called, i make an Http Request to the server, obtain the information (in a XML format), parse the information using Xpath, return the array of results to the class that invoked GSA (in my case a ASP.NET page) and render all the information.
Simple right?
Well, that is not necessarily right. The initial idea of the manager of my project was to copy a code of someone that already implemented a similar thing. Let’s just say that the boy that implemented it didn’t know how to program. Mixed all the fundamentals of programming (divide the application in Layers for instance). The boy inserted all the code in the Load event of the page, in a single method… no comments…
Unfortunately, in Portugal at least, the programming companies only want what we usually call a Code Monkey and, for that reason, the clients spend millions of euros trying to fix something that could be made correctly at first time.