Closed gyeom2ya closed 4 months ago
Do you run the command from redmine's root directory? Does _plugins/redmine_xapian/lib/redmine_xapian/searchdata.rb exist?
Running commands in the Redmayne root directory!
My root directory is /data/redmine, and I also have the /data/redmine/plugins/redmine_xapian/lib/redmine_xapian/search_data.rb file.
I got the plug-in as below. wget https://github.com/xelkano/redmine_xapian/archive/refs/tags/v2.0.2.zip
cat search_data.rb
#
#
#
#
#
module RedmineXapian
class SearchData attr_reader :tokens, :projects, :options, :find_options, :limit_options, :columns, :project_conditions, :user, :element
def initialize(context, tokens, projects, options, user, element) @context = context @tokens = tokens if projects.is_a? Project || projects.nil? @projects = [] << projects else @projects = projects end @options = options @columns = searchable_options[:columns] @user = user @element = element init_find_options(@options) init_limit_options(@options) init_scope_and_projects_conditions(@projects) end
private
def init_limit_options(options) limit_options = {} limit_options[:limit] = options[:limit] if options[:limit] if options[:offset] limit_options[:conditions] = "(#{searchable_options[:date_column]} " + (options[:before] ? '<' : '>') + "'#{connection.quoted_date(options[:offset])}')" end @limit_options = limit_options end
def init_scope_and_projects_conditions(projects) @project_conditions = "projects.id IN (#{projects.collect(&:id).join(',')})" if projects end
def init_find_options(options) find_options = { include: searchable_options[:include] } find_options[:order] = "#{searchable_options[:order_column]} " + (options[:before] ? 'DESC' : 'ASC') @find_options = find_options end
def searchable_options @context.searchable_options end
def connection @context.connection end
end
end
Is there anything else I need to install?
Can you also post a complete output of the migrate command?
The history of migration and adding plug-ins is as follows.
apt-get install build-essential automake libtool apt-get install zlib1g-dev libmagic-dev libsqlite3-dev apt-get ruby-xapian
wget https://oligarchy.co.uk/xapian/1.4.18/xapian-core-1.4.18.tar.xz tar xf xapian-core-1.4.18.tar.xz cd xapian-core-1.4.18/ ./configure make && make install
wget https://oligarchy.co.uk/xapian/1.4.18/xapian-omega-1.4.18.tar.xz tar xf xapian-omega-1.4.18.tar.xz cd xapian-omega-1.4.18/ ./configure make && make install
wget https://oligarchy.co.uk/xapian/1.4.18/xapian-bindings-1.4.18.tar.xz tar -xf xapian-bindings-1.4.18.tar.xz cd xapian-bindings-1.4.18/ ./configure make && make install
cd /data/redmine/plugins/
wget https://github.com/xelkano/redmine_xapian/archive/refs/tags/v2.0.2.zip unzip v2.0.2.zip chown -R redmine.www-data redmine_xapian-2.0.2 mv redmine_xapian-2.0.2 redmine_xapian
cd /data/redmine
bundle install RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_xapian
It looks good. And the error output?
production.log No separate records are verified in the file.
RAILS_ENV=production bundle exec rake db:migrate Migration Messages
rake aborted!
LoadError: cannot load such file -- redmine_xapian/search_data
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in require' /usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in
block in require'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in load_dependency' /usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in
require'
/data/redmine/plugins/redmine_xapian/lib/redmine_xapian.rb:24:in <top (required)>' /usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in
require'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in block in require' /usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in
load_dependency'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in require' /data/redmine/plugins/redmine_xapian/init.rb:30:in
<top (required)>'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in require' /usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in
block in require'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in load_dependency' /usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in
require'
/data/redmine/plugins/easyproject/init.rb:489:in load_plugin_init' /data/redmine/plugins/easyproject/init.rb:475:in
block in load_all_plugins'
/data/redmine/plugins/easyproject/init.rb:474:in each' /data/redmine/plugins/easyproject/init.rb:474:in
load_all_plugins'
/data/redmine/plugins/easyproject/init.rb:443:in `init!
Try to replace plugins/redmine_xapian/lib/redmine_xapian.rb with the last version from the master branch:
# Libraries
require 'redmine_xapian/search_data'
require 'redmine_xapian/xapian_search_service'
# Patches
require 'redmine_xapian/patches/attachment_patch'
require 'redmine_xapian/patches/search_controller_patch'
# Hooks
# Views
require 'redmine_xapian/hooks/views/base_view_hooks'
=>
# Libraries
require "#{File.dirname(__FILE__)}/redmine_xapian/search_data"
require "#{File.dirname(__FILE__)}/redmine_xapian/xapian_search_service"
# Patches
require "#{File.dirname(__FILE__)}/redmine_xapian/patches/attachment_patch"
require "#{File.dirname(__FILE__)}/redmine_xapian/patches/search_controller_patch"
# Hooks
# Views
require "#{File.dirname(__FILE__)}/redmine_xapian/hooks/views/base_view_hooks"
I changed the version you delivered, and the error that occurs during migration has changed!
vim /data/redmine/plugins/redmine_xapian/lib/redmine_xapian.rb
require "#{File.dirname(FILE)}/redmine_xapian/search_data" require "#{File.dirname(FILE)}/redmine_xapian/xapian_search_service"
require "#{File.dirname(FILE)}/redmine_xapian/patches/attachment_patch" require "#{File.dirname(FILE)}/redmine_xapian/patches/search_controller_patch"
require "#{File.dirname(FILE)}/redmine_xapian/hooks/views/base_view_hooks"
RAILS_ENV=production bundle exec rake db:migrate
rake aborted!
NameError: uninitialized constant RedmineXapian::XapianSearchService::XapianSearch
/data/redmine/plugins/redmine_xapian/lib/redmine_xapian/xapian_search_service.rb:26:in <class:XapianSearchService>' /data/redmine/plugins/redmine_xapian/lib/redmine_xapian/xapian_search_service.rb:25:in
<top (required)>' /data/redmine/plugins/redmine_xapian/lib/redmine_xapian.rb:25:in
<top (required)>'
/data/redmine/plugins/redmine_xapian/init.rb:30:in `<top (required)>'
Hm... So, try also this:
_plugins/redmine_xapian/lib/redmine_xapian/xapian_searchservice.rb
-- extend XapianSearch
++ extend RedmineXapian::XapianSearch
Thank you for continuously responding quickly.
vim plugins/redmine_xapian/lib/redmine_xapian/xapian_search_service.rb
extend XapianSearch -> extend RedmineXapian::XapianSearch
After the modification cd /data/redmine
RAILS_ENV=production bundle exec rake db:migrate
rake aborted!
NameError: uninitialized constant RedmineXapian::XapianSearch
/data/redmine/plugins/redmine_xapian/lib/redmine_xapian/xapian_search_service.rb:26:in <class:XapianSearchService>' /data/redmine/plugins/redmine_xapian/lib/redmine_xapian/xapian_search_service.rb:25:in
<top (required)>' /data/redmine/plugins/redmine_xapian/lib/redmine_xapian.rb:25:in
<top (required)>'
There is still an error. Can you give me more help?
All these problem seem to be related to the Easy plugin. I'm not sure whether it will work with it...
_plugins/redmine_xapian/lib/redminexapian.rb
# Libraries
require "#{File.dirname(__FILE__)}/redmine_xapian/search_data"
++ require "#{File.dirname(__FILE__)}/redmine_xapian/xapian_search"
require "#{File.dirname(__FILE__)}/redmine_xapian/xapian_search_service"
I was also suspecting that other users didn't have this issue while proceeding.
I also think it's an easy redmine problem,
Finally, after proceeding with the modification, another error was waiting for me during the migration.
rake aborted!
NameError: uninitialized constant RedmineXapian::ContainerTypeHelper
/data/redmine/plugins/redmine_xapian/lib/redmine_xapian/xapian_search.rb:26:in <module:RedmineXapian>' /data/redmine/plugins/redmine_xapian/lib/redmine_xapian/xapian_search.rb:25:in
<top (required)>'
/data/redmine/plugins/redmine_xapian/lib/redmine_xapian.rb:25:in <top (required)>' /data/redmine/plugins/redmine_xapian/init.rb:30:in
<top (required)>'
Although the application failed, thank you for your help.
BTW, the latest EasyRedmine has got an integrated full-text search. Try this: _plugins/redmine_xapian/lib/redminexapian.rb
# Libraries
require "#{File.dirname(__FILE__)}/redmine_xapian/search_data"
++ require "#{File.dirname(__FILE__)}/redmine_xapian/xapian_search"
++ require "#{File.dirname(__FILE__)}/redmine_xapian/container_type_helper"
require "#{File.dirname(__FILE__)}/redmine_xapian/xapian_search_service"
It worked for me!
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_xapian == == 1 CreateIndexinglogs: migrating ============================================ -- -- create_table(:indexinglogs, {:options=>"ENGINE=InnoDB", :id=>:integer}) -> 0.0491s == == 1 CreateIndexinglogs: migrated (0.0493s) ===================================
== == 20150612131001 AddIndexToIndexlogs: migrating ============================== -- -- add_index(:indexinglogs, :repository_id) -> 0.0123s == == 20150612131001 AddIndexToIndexlogs: migrated (0.0124s) =====================
apachectl restart
The plug-in is normally output when accessing the WEB page.
Thank you so much for your help!
Hello.
I need a full search function, so I found xapian while searching.
The version I'm using is as follows.
OS Ubuntu 18.04
ruby -v ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
Easy Redmine: Brand version ER 2019 Platform version 10.0.1 Build version (build not detected) Full version ER 2019 (Platform: 10.0.1) Environment: Redmine version 4.1.0.stable Ruby version 2.5.1-p57 (2018-03-29) [x86_64-linux-gnu]
I followed the manual, but an error occurred.
RAILS_ENV=production bundle exec rake db:migrate LoadError: cannot load such file -- redmine_xapian/search_data
irb 2.5.5 :001 > require 'xapian' => true
Can you help me with what the problem is?