Feature #3021

Extend search with plugins

Added by Chaoqun Zou about 10 years ago. Updated over 8 years ago.

Status:ClosedStart date:2009-03-22
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Plugin API
Target version:-
Resolution:Duplicate

Description

For now the search scope in search controller can't be extended by plugins.

See ln51 in search_controller.rb

@object_types = %w(issues news documents changesets wiki_pages messages projects)

So if there is a plugin_hook which let plugin add object_types to above, the plugin can easily integrated their search function into redmine's search page.


Related issues

Duplicates Redmine - Feature #3936: configurable list of models to include in search Closed 2009-09-28

History

#1 Updated by Markus Knittig about 10 years ago

That's not a job for a hook, but yes, this should be extendable...

#2 Updated by Jean-Philippe Lang about 10 years ago

  • Subject changed from Need a plugin_hook which can let plugin to extend redmine's search scope to Extend search with plugins

#3 Updated by Eric Thomas about 9 years ago

Any update to this?

#4 Updated by Gonzalo Fernández-Victorio over 8 years ago

As of version 1.0.0.stable I have managed to incorporate search to a plugin with the following changes:

  1. Provide search scope in the controller. For example for EzPlugin I had to write
    class EzfaqController < ApplicationController
    [...]
      default_search_scope :faqs
    [...]
    
  2. Provide ability to search in the model (In EzPlugin it's already in the plugin)
    class Faq < ActiveRecord::Base
    [...]
      acts_as_searchable :columns => ["#{table_name}.question", "#{table_name}.answer"],
                            :include => [:project]
    [...]
    
  3. Register the plugin in Redmine search (libs/redmine.rb)
    Redmine::Search.map do |search|
    [...]
      search.register :faqs
    [...]
    

#5 Updated by Eric Davis over 8 years ago

  • Assignee deleted (Eric Davis)

#6 Updated by Mischa The Evil over 8 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Closed as being a duplicate of the (implemented) issue #3936.

Also available in: Atom PDF