The listing adds withHighlighter to the params object then passes it into the search method provided by the searchable plugin. When running the search, I encounter this:
2014-01-12 22:58:54,478 [http-bio-8080-exec-8] WARN grailsinaction.SearchController - Could not search
Message: Trying to use highlighter, but no highlighter jar included
Line | Method
->> 278 | getHighlighterManager in org.compass.core.lucene.engine.LuceneSearchEngineFactory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 75 | <init> in org.compass.core.lucene.engine.LuceneSearchEngineHighlighter
| 83 | getHighlighter . . . in org.compass.core.lucene.engine.DefaultLuceneSearchEngineHits
| 46 | <init> in org.compass.core.impl.DefaultCompassHighlighter
| 100 | highlighter . . . . . in org.compass.core.impl.DefaultCompassHits
| 189 | doWithHighlighter in grails.plugin.searchable.internal.compass.search.DefaultSearchMethod$SearchCompassCallback
| 141 | doInCompass . . . . . in ''
| 133 | execute in org.compass.core.CompassTemplate
| 56 | doInCompass . . . . . in grails.plugin.searchable.internal.compass.support.AbstractSearchableMethod
| 71 | invoke in grails.plugin.searchable.internal.compass.search.DefaultSearchMethod
| 43 | doCall . . . . . . . in grails.plugin.searchable.internal.compass.domain.DynamicDomainMethodUtils$_attachDynamicMethods_closure1
| 20 | search in com.grailsinaction.SearchController$$EOSnHGpL
| 200 | doFilter . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1110 | runWorker . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . . . . in java.lang.Thread
......
Intellij says that the search method does not take a GrailsParameterMap as the second argument.
When I use the highlighter like this:
def searchResult = Post.search(query, withHighLighter: { highlighter, index, sr ->
if (!sr.highlights) {
sr.highlights = []
}
//store highlighted text
//content is a searchable property of the Post domain class
def matchedFragment = highlighter.fragment("content")
sr.highlights[index] = "...${matchedFragment ?: ""}..."
})
This fixes the exception on the controller side but the view is not rendering. Currently highlights is never set on searchResult which leaves me to believe that the highlighter closure is not highlighting.
I'm getting the missing jar exception again. I'll have to look into this more.
PS @pledbrook I think the note about IntelliJ is a red herring. I saw that there were some major changes with searchable 0.6.5 and all the back and forth on the plugin forum.
Using: Grails 2.3.4, ":searchable:0.6.6"
The listing adds
withHighlighter
to theparams
object then passes it into thesearch
method provided by the searchable plugin. When running the search, I encounter this:Intellij says that the search method does not take aGrailsParameterMap
as the second argument.When I use the highlighter like this:
This fixes the exception on the controller side but the view is not rendering. Currently
highlights
is never set onsearchResult
which leaves me to believe that the highlighter closure is not highlighting.I'm getting the missing jar exception again. I'll have to look into this more.
PS @pledbrook I think the note about IntelliJ is a red herring. I saw that there were some major changes with searchable 0.6.5 and all the back and forth on the plugin forum.