Class: ProjectSearch::LuceneRefresh

Inherits:
Redcar::Task show all
Defined in:
plugins/project_search/lib/project_search/lucene_refresh.rb

Instance Attribute Summary

Attributes inherited from Redcar::Task

#_queue, #completed_time, #enqueue_time, #error, #start_time

Instance Method Summary (collapse)

Methods inherited from Redcar::Task

#call, #cancel, #cancelled?, #completed?, #in_process?, #inspect, #pending?

Constructor Details

- (LuceneRefresh) initialize(project)

A new instance of LuceneRefresh



5
6
7
# File 'plugins/project_search/lib/project_search/lucene_refresh.rb', line 5

def initialize(project)
  @project     = project
end

Instance Method Details

- (Object) description



9
10
11
# File 'plugins/project_search/lib/project_search/lucene_refresh.rb', line 9

def description
  "#{@project.path}: refresh index"
end

- (Object) execute



13
14
15
16
17
18
19
# File 'plugins/project_search/lib/project_search/lucene_refresh.rb', line 13

def execute
  unless index = ProjectSearch.indexes[@project.path]
    index = ProjectSearch::LuceneIndex.new(@project)
    ProjectSearch.indexes[@project.path] = index
  end
  index.update
end