Grails: Lucene, Compass Query Builder and date ranges

前端 未结 1 1436
梦毁少年i
梦毁少年i 2021-01-24 17:19

I have the searchable plugin working with my grails project. I have it indexing 4 different tables at work. Unfortunately, each table has a date field that is named differently

相关标签:
1条回答
  • 2021-01-24 17:44

    you can configure your domain classes to override or provide additional Lucene index entries for a property under different names.

    So, suppose that you have a class with a 'publishedOn' property, but you want that property to be searchable as both 'publishedOn' and 'createdAt'. You would do something like the following:

    class ADomainClass {
        Date publishedOn
    
        static searchable = {
           'publishedOn' format:'yyyyMMdd'
           'publishedOn' name: 'createdAt', format 'yyyyMMdd'
        }
    }
    

    If you only want it to be searchable as 'createdAt', then just leave out the first 'searchable' entry.

    0 讨论(0)
提交回复
热议问题