2013-08-05 3 views
1

내가레일 3 검색 알고리즘 구현

@keywords = [['undergrad','grad'],['SAT', 'GPA'], ['Stanford']] 

같은 배열로 사용자의 입력을 받아 필터링 알고리즘을 쓰고 있어요 예를 들어, 테이블을 쿼리, 내 데이터베이스에서 비디오 테이블. 쉼표로 구분 된 두 개의 태그를 포함하는 문자열 필드가 테이블에 있습니다.

논리는 다음과 같습니다 레일에 구현에

In all videos, if the tags include "undergrad", "grad", returned those videos; 
In the returned videos, if the tags include "SAT", "GPA", returned those videos; 
In the returned videos, if the tags include "Stanford", returned those videos; 

어떤 도움?

+0

태그 지정은 어떻게 구현합니까? https://github.com/mbleigh/acts-as-taggable-on과 같은 것을 사용하고 있습니까, 아니면 동영상 테이블의 입력란입니까? – Cyrus

+0

태그는 쉼표로 구분 된 단어를 포함합니다. e.x, "undergrad, GPA" –

+0

비디오 모델에 직접 저장되어 있습니까? – Cyrus

답변