클래스에 배열 배열이 있습니다. 태그 배열에 여러 값 중 하나가 포함되어있는 경우 전체 텍스트 검색 범위를 개체로 반환하고 싶습니다. 태그가 여러 개이고 범위 값이 여러 개이므로이 방법이 가능한지 확실하지 않습니다.Sunspot/Solr 배열 필드 별 범위
class Video
include Sunspot::Mongoid2
field :categories, type: Array, default: [] # array of strings
field :description, type: String, default: ""
field :title, type: String, default: ""
searchable do #these fields will be indexed by sunspot/solr
text :title
text :description
string :categories # this seems wrong but there is no array field type?????
end
end
이 더 array
필드 유형이없는 문자열의 배열 string
과 동일하지 않습니다 때문에 잘못된 것 같다. 객체가 가질 수 있도록 categories
종종 여러 값을 가지고 있기 때문에
search = Video.search do
fulltext params[:q] do
fields :title, :description
end
with(:categories, ["Netflix", "Amazon"])
end
@videos = search.results
다시 말하지만, 이것이다 : 내가하고 싶습니다 전체 텍스트 쿼리가이 같은 것입니다 그러나
video.categories = ["Horror", "Drama", "Netlfix"]
fulltext
이 위의 카테고리 중 하나 이상과 일치하는 경우이 객체를 반환하고 싶습니다. with(:categories, ["Netflix", "Amazon"])
태양 흑점에서 이것을 할 수있는 방법이 있습니까?