FIX es bug

This commit is contained in:
Jasder 2019-11-14 15:12:20 +08:00
parent 3608ae16c4
commit 3bcd7c408a
7 changed files with 43 additions and 8 deletions

View File

@ -17,6 +17,7 @@
require "digest/md5"
require "fileutils"
require 'elasticsearch/model'
class Attachment < ActiveRecord::Base
belongs_to :container, :polymorphic => true
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
@ -47,7 +48,12 @@ class Attachment < ActiveRecord::Base
include ApplicationHelper
#elasticsearch
include Searchable
include Elasticsearch::Model
document_type 'doc' # 解决因Elasticsearch版本导致es语法错误的问题
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :filename, analyzer: 'smartcn',index_options: 'offsets'

View File

@ -1,5 +1,5 @@
require 'elasticsearch/model'
module Searchable
module EsSearchable
extend ActiveSupport::Concern
included do

View File

@ -1,5 +1,5 @@
#coding=utf-8
require 'elasticsearch/model'
class Course < ActiveRecord::Base
include Redmine::SafeAttributes
@ -10,7 +10,12 @@ class Course < ActiveRecord::Base
STATUS_ARCHIVED = 9
#elasticsearch
include Searchable
include Elasticsearch::Model
document_type 'doc' # 解决因Elasticsearch版本导致es语法错误的问题
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'

View File

@ -1,3 +1,4 @@
require 'elasticsearch/model'
class Memo < ActiveRecord::Base
include Redmine::SafeAttributes
include UserScoreHelper
@ -14,7 +15,12 @@ class Memo < ActiveRecord::Base
#elasticsearch
include Searchable
include Elasticsearch::Model
document_type 'doc' # 解决因Elasticsearch版本导致es语法错误的问题
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: {
number_of_shards: 5 ,
analysis: {

View File

@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'elasticsearch/model'
class Project < ActiveRecord::Base
include Redmine::SafeAttributes
ProjectType_project = 0
@ -30,7 +31,12 @@ class Project < ActiveRecord::Base
# Specific overidden Activities
#elasticsearch
include Searchable
include Elasticsearch::Model
document_type 'doc' # 解决因Elasticsearch版本导致es语法错误的问题
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'

View File

@ -1,9 +1,15 @@
# encoding: utf-8
require 'elasticsearch/model'
class Syllabus < ActiveRecord::Base
include Redmine::SafeAttributes
include ApplicationHelper
#elasticsearch
include Searchable
include Elasticsearch::Model
document_type 'doc' # 解决因Elasticsearch版本导致es语法错误的问题
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :title, analyzer: 'smartcn',index_options: 'offsets'

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require "digest/sha1"
require 'elasticsearch/model'
class User < Principal
TEACHER = 0
STUDENT = 1
@ -25,7 +26,12 @@ class User < Principal
include Redmine::SafeAttributes
seems_rateable_rater
#elasticsearch
include Searchable
include Elasticsearch::Model
document_type 'doc' # 解决因Elasticsearch版本导致es语法错误的问题
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :login, analyzer: 'smartcn',index_options: 'offsets'