ฉันกำลังพยายามใช้ Haystack ด้วย whoosh
ฉันได้รับข้อผิดพลาดนี้อยู่เรื่อยๆ แม้ว่าทุกอย่างดูเหมือนจะได้รับการกำหนดค่าได้ดีก็ตาม ฉันได้รับข้อผิดพลาด:
haystack.exceptions.SearchBackendError: No fields were found in any search_indexes. Please correct this before attempting to search.
...เมื่อฉันพยายามทำ ./manage.py rebuild_index
การกำหนดค่า:
HAYSTACK_SITECONF = 'myproject'
HAYSTACK_SEARCH_ENGINE = 'whoosh'
HAYSTACK_WHOOSH_PATH = cwd + '/whoosh/mysite_index'
มีการสร้างไดเร็กทอรี whoosh/mysite_index ในโฟลเดอร์รูทของโปรเจ็กต์ของฉันสำเร็จแล้ว
*search_sites.py*
import haystack
haystack.autodiscover()
*search_indexes.py*
from haystack.indexes import *
from haystack import site
from myproject.models import *
class ResearchersIndex(SearchIndex):
text = CharField(document=True, use_template=True)
name = CharFIeld(model_attr='name')
class SubjectIndex(SearchIndex):
short_name = CharField(model_attr='short_name')
name = CharField(model_attr='name')
text = CharField(document=True, use_template=True)
class ResearchIndex(SearchIndex):
text = CharField(document=True, use_template=True)
abstract = TextField(model_attr='abstract')
methodology = TextField(model_attr='methodology')
year = IntegerField(model_attr='year')
name = CharField(model_attr='name')
class Graph(SearchIndex):
text = CharField(document=True, use_template=True)
explanation = TextField(model_attr='explanation')
type = CharField(model_attr='type')
name = CharField(model_attr='name')
site.register(Researchers, ResearchersIndex)
site.register(Subject, SubjectIndex)
site.register(Research, ResearchIndex)
site.register(Graph, GraphIndex)
ขอบคุณ
search_sites
ไม่ได้ถูกเรียก - person anacarolinats   schedule 08.03.2013