weitere classen durchsuchen

This commit is contained in:
Andreas Stephanides
2014-11-12 21:24:18 +01:00
parent e9245919c3
commit dc124e3810
18 changed files with 99 additions and 19 deletions

View File

@@ -198,6 +198,15 @@ class Lva < ActiveRecord::Base
newlvas
end
searchable do
text :desc
text :pruefungsinformation
text :lernaufwand
text :typ
text :name, :boost=>3.0
end
def self.update_multiple_with_modul(hash,modul)
newlvas=[]
hash.each do |i,l|
@@ -222,5 +231,5 @@ class Lva < ActiveRecord::Base
newlvas
end
end

View File

@@ -53,4 +53,9 @@ class Modul < ActiveRecord::Base
end
m
end
searchable do
text :desc
text :name, :boost=>3.0
end
end

View File

@@ -32,4 +32,10 @@ class Modulgruppe < ActiveRecord::Base
def studium_name
self.studium.nil? ? "Kein Studium vorhanden" : self.studium.name
end
searchable do
text :desc
text :typ
text :name, :boost=>3.0
end
end

View File

@@ -84,7 +84,8 @@ class Neuigkeit < ActiveRecord::Base
end
end
searchable do
text :text, :datum
text :text
text :datum
text :title, :boost=>3.0
end
end

View File

@@ -35,4 +35,10 @@ end
self.calendar.public=self.public
self.calendar.save
end
searchable do
text :desc
text :name, :boost=>4.0
end
end

View File

@@ -84,5 +84,12 @@ validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$
""
end
end
searchable do
text :desc
text :zahl
text :typ
text :abkuerzung
text :name, :boost=>3.0
end
end

View File

@@ -23,8 +23,14 @@ include Rails.application.routes.url_helpers
validates :text, :presence => true
scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true)
default_scope order("themen.priority").reverse_order
scope :search, ->(query) {where("themen.text like ? or themen.title like ?", "%#{query}%", "%#{query}%")}
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",2.month.ago).where("thema_translations.locale"=>I18n.t.locale)
# scope :search, ->(query) {where("themen.text like ? or themen.title like ?", "%#{query}%", "%#{query}%")}
searchable do
text :text
text :title, :boost=>4.0
end
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",2.month.ago).where("thema_translations.locale"=>I18n.t.locale)
}
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
def is_outdated?

View File

@@ -36,4 +36,9 @@ end
self.save;
end
searchable do
text :text
text :title, :boost=>4.0
end
end