1
我正在研究http://code.google.com/p/django-fts/應用程序的工作方式。我試圖設置psql FTS來處理應用程序,但無法理解如何正確創建索引。django-fts:如何爲psql創建索引
不明白如何創建GIN索引,因爲它是在doc中指定的。
我的模型如下:
class Product(fts.SearchableModel):
name = models.CharField(max_length = 1000)
description = models.TextField(blank = True)
在我有一個表store_product
但數據庫
當我跑在我的PSQL下面,我有一個錯誤:
base=# CREATE INDEX "store_product_index" ON "store_product" USING gin("name");
ERROR: data type character varying has no default operator class for access method "gin"
HINT: You must specify an operator class for the index or define a default operator class for the data type.
你能幫我理解這裏有什麼問題嗎?
感謝您的回答。它給了我一個錯誤: – 2010-10-06 12:26:51
db =#CREATE INDEX「store_product_index」ON「store_product」使用杜松子酒(to_tsvector('english',name)); 錯誤:函數to_tsvector(「未知」,字符變化)不存在 線1:... tore_product_index「ON」store_product「使用杜松子酒(to_tsvecto ... ^ 提示:沒有函數匹配給定的名稱和參數類型你可能需要添加明確的類型轉換 – 2010-10-06 12:27:15
你使用的是什麼版本的PostgreSQL?你確定你是一個內置的全文搜索的嗎?如果沒有,你需要安裝tsearch模塊... – 2010-10-07 17:15:44