Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Recent blogs

RSS - Blogs
March 9, 2010
State of OSGi in the Java world
March 4, 2010
Reach more people with Google Translate
March 3, 2010
Get My Advice
February 26, 2010
What? Where!?!
February 11, 2010
Split it!

All Blogs...


What? Where!?!

February 26, 2010


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.



So, ehr... What does this mean to me?

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:

WebManager search
  • Autocompletion: While you type, the search engine is consulted about possible results. Also note that the projected number of results is behind each suggestion!
  • Suggestions: I searched for "develop", but maybe I meant other words that were indexed?
  • Types with counts: Search results can be fragmented into partial results and the searchengine can return totals.
  • Timebased search: Want to restrict your search to a limited frame of time?
  • Relevant exerpts with highlight: The search engine not only stores some abstract for a document, but can also reproduce relevant exerpts where the words occur.

I bet you're baffled by now! I know I was when I first saw this. This is the best thing since sliced bread!


Sweet! How does it all work?

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:


  • searchElement.jspf
  • searchElementFacets.jspf
  • searchElementFacetsAjaxCall.jspf
  • searchElementFacetsAutoComplete.jspf

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

About the Author

Return to all blogs

 

Patrick Atoon

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:

September 3, 2009
Do the Right Thing
June 18, 2009
wm:link secrets
March 2, 2009
Server side represent! (Part 2)
February 4, 2009
Server side represent!
January 15, 2009
Making cache
December 9, 2008
Like A Version
August 19, 2008
Stop making sense
August 4, 2008
Namaste!
July 7, 2008
Japanese encore (日本のアンコール)
May 20, 2008
All amped up


Share:

del.icio.us
digg
Technorati
Slashdot
Reddit
YahooMyWeb
NewsVine
ekudos
© 2010 GX creative online development B.V.

Disclaimer

This website (GXdeveloperweb.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.