2012-05-24 5 views
5

난 내 레일 응용 프로그램에 대한 solr 검색을 구현했습니다. 검색을 위해 필드를 인덱싱했으며 완벽하게 작동합니다. 이제는 searching 동안 Title이라는 이름의 특정 필드를 제외하고 싶습니다. 검색하는 동안이 특정 필드를 건너 뛸 수 있습니까? 색인 텍스트 필드에 대한 제외 옵션도 있습니까? 내가 이런 식으로 할 수있는 방법이Sunspot/Solr 전체 텍스트 검색 - 전체 텍스트 검색에서 특정 필드를 제외하는 방법?

profiles = Profile.search do |s| 
    s.fulltext @selected_filters[:query][:value] , exclude => :title 
end 

search.like 전체 텍스트에서만 제목 필드를 제외 할 수 있습니다 방법은 다음과

searchable do 

    integer :id 
    boolean :searchable 
    boolean :premium 
    string :status 
    time :updated_at 
    time :created_at 

    ################################################### 
    # Fulltext search fields 

    text :title 

    text :summary 
    text :skills 

end 

? 당신은 이 검색에을 포함하는 필드를 지정할 수 있습니다

답변

4

도와주세요

Profile.search do 
    keywords @selected_filters[:query][:value], :fields => [:summary, :skills], :minimum_match => 1 
end