, 데이터베이스는 레일에서 변경 어떻게하면 자동으로 인덱싱을 태양 흑점 3 내가 오늘 Sunspot_rails 프로젝트를 배울
내 데모 클립을 참조하십시오 http://youtu.be/qmtbDg4VtOw때마다 데이터베이스 내로 새 항목을 추가,
우리 해야합니까
rake sunspot:reindex
그래서 우리는 흑점 검색을 통해 새롭게 추가 된 날짜를 검색 할 수 있습니다.
데이터베이스가 변경 자동으로
실행
rake sunspot:reindex
더 나은 방법이? 사전에
감사
PS : 레이크 태양 흑점을 실행하는 경우 : 명령 행에서 색인화 나는이 옵션을 사용하지 prompt.Can, 그것은 확인을 보여줍니다. [책] $ 레이크 태양 흑점 : 데이터베이스에 저장할 때마다 Solr
에 모델을 업데이트
*Note: the reindex task will remove your current indexes and start from scratch.
If you have a large dataset, reindexing can take a very long time, possibly weeks.
This is not encouraged if you have anywhere near or over 1 million rows.
Are you sure you want to drop your indexes and completely reindex? (y/n)
# Sunspot
searchable do
text :name
text :author
text :comment
text :sale_type
text :category
# text :isbn
end
sunspot.yml 기본적으로
[config] $ cat sunspot.yml
production:
solr:
hostname: localhost
port: 8983
log_level: WARNING
# read_timeout: 2
# open_timeout: 0.5
development:
solr:
hostname: localhost
port: 8982
log_level: INFO
test:
solr:
hostname: localhost
port: 8981
log_level: WARNING
기본적으로 새 데이터는 Sunspot에 의해 추가 된'save' 콜백 (@MauricioLinhares가 작성한 것처럼)에 색인을 붙여야합니다. 다른 동작을하면'searchable' 블록을 붙여 넣어야합니다. – zrl3dx
환경에 추가 된'config/sunspot.yml' 파일에'auto_commit_after_request : false' 행이 있습니까? 편집 : and silencing boolean prompt :'rake sunspot : reindex [,, true]'** 이것은 ** 확인을 요구하지 않고 다시 인덱스를 수행해야하지만 이것은'sunspot_solr' gem 버전에 달려있다. 그 특정 작업). – zrl3dx
sunspot.yml에 auto_commit_after_request가 없습니다. – newBike