RSS
热门关键字:  数据挖掘  数据仓库  商业智能  搜索引擎  人工智能

Grails的全文检索插件

来源: 作者: 时间:2008-06-25 点击:

Searchable Plugin

The Searchable Plugin aims to provide rich search features to Grails applications with minimum effort, and still give you power and flexibility when you need it.

It is built on the fantastic Compass Search Engine Framework and Lucene and has the same license as Grails (Apache 2).

The roadmap and issues are tracked in JIRA.

    Intially the plugin will focus on exposing Groovy domain models.

    Support for Java domain classes is on the roadmap but until then, if your Grails application uses Java domain classes, using Compass's native annotations or XML mapping config and setting up Compass yourself may be a better fit at this stage.

Features

The plugin:

    * Detects searchable classes and maps them to the search index
    * Performs a bulk index of all searchable class instances in the database
    * Automatically synchronises any changes made through GORM/hibernate with the index 数据挖掘研究院
    * Adds domain class methods for easy class-based searching and index management
    * Provides a {{SearchableService}} for easy application-wide searching and index management
    * Provides a {{SearchableController}} for testing queries and demonstrating the Searchable Plugin API
    * Provides a configuration mechanism to enable/disable features and override default behavoir if necessary

Quick start

Install the plugin

grails install-plugin searchable

Define Searchable classes

Add a static searchable property in the domain classes you need to be searchable, for example:

/**
 * A blog post
 */
class Post {
    static searchable = true             // maps and indexes Post instances with default rules
    static hasMany = [comments: Comment] // Comment could also be "searchable" In order to get a many to one mapping to index correctly additional steps are required.  Following this link http://www.nabble.com/Searchable-plugin-problem-td17573290.html 数据挖掘研究院
    User author                          // User could also be "searchable"
    String category, title, post
    Date postDate
}

(_There are more ways to map your classes to the search index, but this is enough for now._)

Try it!

Fire up your app… _during startup the plugin will build the search index all for searchable class instances in your database_.

Navigate to http://localhost:8080/YOUR-APP-NAME-HERE/searchable, and try a few queries. Here's a screenshot from my own app:
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
匿名?