Did you notice it? Something has changed!
I must admit, it is a bit hidden and you really have to pay close attention in order to notice it.
I'm talking about the new search engine! You may not have noticed it, but back in 2009 the old search engine was replaced by a (backwards compatible) new version. If you have installed the latest GX WebManager Community Edition, you automatically have it.
The search engine is based on Apache Solr, a blazing fast open source enterprise search platform with a plethora of features. Like the previous search engine, Solr is based on Apache Lucene, a Java search library.
Well... This new cookie jar is filled to the brim with goodies! You suddenly get the power to do very cool stuff on your website. A brief look at the new search interface probably says it all:
I bet you're baffled by now! I know I was when I first saw this. This is the best thing since sliced bread!
Ack! I guess I had that one coming.
To be honest, I didn't have a clue either. But on the bright side, there is always the source of the Community Edition on disk. :-)
These are the files responsible for the new search element:
Browsing through the code it becomes more clear. The new search works completely different from the old one.
Forget about extracting results from the session XML! This baby uses Ajax calls to retrieve results straight from the search engine. And at the center of it all is a new tag: <wm:search>.
The wm:search tag only has two arguments: "query" and "var" and it returns a search result. A very basic example use would look like this:
<%-- Hardcoded search for the word "developer" --%>
<wm:search var="searchResult" query="q=developer" />
<c:set var="results" value="${searchResult.results}" />
<c:forEach items="${results}" var="doc">
<c:set var="values" value="${doc.fieldValueMap}" />
<c:set var="title" value="${values['title']}" />
<c:set var="url" value="${values['location']}" />
<a href="${url}">${title}</a><br />
</c:forEach>
Interesting stuff!
In a future posting I will delve deeper into the details of this new tag and its search results. As you will find out, there are tons of options you can pass on with the query and plenty of fields to sift through when you get results.
For now, I will leave you to play a bit with the new search engine. Just download the latest Community Edition and install it. But before that, check out this Death Metal Rooster:
Till next time,
Patrick
Patrick Atoon has gained nuff respect as one of the most experienced web architects in the GX Webmanager community or even the global hip hop community for that matter.
Read all Patricks blog entries
Other blog entries: