Donnerstag Mrz 25, 2010

Roolastic - Part Three

Part One

Part Two

Part Four

Now that we have our little webapp running and we can add images to it and they get indexed, we need a way to query the index.
So we quickly create a SearchController by running

controller class --class ~.web.SearchController
then we add a little search form to the index view, create a new view for the results (don't forget to adapt the tiles config in views.xml) and implement the controller logic for stuffing the result in our model like here.
I've done a couple of things here:
  1. I put a JSON expression into the search field to give you a head start
  2. I implemented two different controller methods linked to the two different search buttons. One just stuffs the json coming back from elasticsearch into the model and one deserialises the returned results back into entity instances and stuffs those into the model
That is all still very primitive but it is sufficient I think to get started and experiment with ElasticSearch's possibilities. You should be aware though, that I currently shave off all search metadata from the results and just return the results source in the order they come back from ElasticSearch.

Kommentare:

Senden Sie einen Kommentar:
Kommentare sind ausgeschaltet.