Making joda.DateTime a searchable property in grails -


i using joda time library in grails project. i've installed searchable plugin. have few domains important :

import org.joda.time.datetime  class entry {       static searchable = {      except = ['id', 'version']      spellcheck "include"      tags component: true       title boost: 2.0         datecreated boost: 2.0      }   string title  string content  datetime datecreated  datetime lastupdated  } 

but on initialization encounter following error:

unable map [entry.datecreated]. not appear suitable 'searchable property' (normally simple types strings, dates, numbers, etc), 'searchable reference' (normally domain class) or 'searchable component' (normally domain class defined component, using 'embedded' declaration). derived property (a getter method no equivalent field) defined 'def'? try defining more specific return type

my question: possible make datecreated and/or lastupdated properties searchable in grails? if possible, how can done?

thanks.


edit

if define custom converter in config.groovy so:

map compasssettings = [ 'compass.converter. funkyconverter.type':'com.acme.compass.converter.funkyconverter']

what defined in funkyconverter class?

the version of compass came version 0.6 of searchable (any maybe earlier versions) had special case code in (in class org.compass.core.converter.defaultconverterlookup) org.joda.time.datetime class. can't speak directly whether works or not, looked try automatically make use of org.compass.core.converter.extended.datatimeconverter included in compass joda datetime class.

however, joda localdate , localtime classes, there no built-in support. recent bug fix searchable version 0.6.1 ( http://jira.grails.org/browse/gpsearchable-28 ) along use of registerclass configuration in searchable.groovy shown below has fixed "it not appear suitable 'searchable property'..." problem occurring @ application startup while domain objects being instantiated in bootstrap.groovy.

compasssettings = [     "compass.converter.jodatime.type": "net.streamrecorder.web.converter.localtimeconverter",     "compass.converter.jodatime.registerclass": "org.joda.time.localtime" ] 

note net.streamrecorder.web.converter.localtimeconverter own creation. modeled after org.compass.core.converter.extended.datatimeconverter. there converter localdate in diff referenced gpsearchable-28 ticket: ( http://jira.grails.org/secure/attachment/15729/0001-nasty-fixes-and-workarounds-for-adding-custom-compas.patch ) , of course, still need specify converter domain member variable in domain class described here: ( http://grails.org/searchable+plugin+-+converters )


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

sql server - python to mssql encoding problem -

windows - Python Service Installation - "Could not find PythonClass entry" -