그래서 더 큰 프로젝트를 수행했으며이를 수정하는 코드를 어디에서 찾을 수 있는지 확신 할 수 없습니다. 우리는 에세이 -> 섹션 -> 그림으로 읽혀지는 데이터베이스를 가지고 있으며, 'video_url'이라는 새로운 컬럼을 추가하려고합니다. 나는 이것이 비정규 화와 관련이 있다고 믿지만, 나는 완전히 확신하지는 않는다. 지금 그것은 단지에 [매시 캡션, 신용, 그림 (#), URL을]elasticsearch 쿼리의 결과 열 수정
class Essay
include ActiveModel::Model
include ActiveModel::Serialization
include Draper::Decoratable
include Import::HtmlEssay
include Searchable
FACETS = %w(author)
FULLTEXT_FIELDS = %w(title sections.title sections.body sections.figures.caption)
def self.define_mappings!
mapping mapping_options do
analyzer = I18n.locale == :tr ? :turkish : :snowball
indexes :author, index: :not_analyzed
indexes :publication_id, index: :not_analyzed
indexes :sequence, type: 'long'
indexes :title, analyzer: analyzer
indexes :sections do
indexes :title, analyzer: analyzer
indexes :body, analyzer: analyzer
indexes :figures do
indexes :caption, analyzer: analyzer
end
end
end
end
class Query
include Searchable::Query
def sort
[
{ publication_id: { order: 'asc'}},
{ sequence: { order: 'asc' }}
]
end
end
end
:
다음은 에세이 모델입니다. 비디오 모델의 일부인 video_url을 URL에 추가하고 싶습니다. 그러나이 모델이 어떻게 작동하는지, 문제가 있는지는 잘 모르겠습니다. 그들이 사용하고 있다고 생각하는 유일한 관련 보석은 elasticsearch-model입니다. 그러나 나는 그들의 재료를 많이 훑어 보았지만 확실하지는 않습니다. (아무것도 정말 여기 일이없는 것 것은 있지만)입니다
는 는 제어뿐만 아니라 다음과같이
class EssaysController < SearchBaseController
def show
@essay = Essay.find(params[:id]).decorate
end
end
을 솔직히 "FULLTEXT_FIELDS"VAR 같은 심지어 일이 어디 있는지 말해 줄 수 있다면 당신이 답을 모르더라도 그로부터 오는 것이 매우 도움이 될 것입니다. 필요하다면이 코드를 편집하여 다른 코드 섹션을 추가 할 수 있습니다. 방금 결과에 video_url 열을 추가하는 방법을 알아야합니다. 탄성 검색에 있으며 다른 방법으로 액세스 할 수 있지만 여기에는 표시되지 않습니다.