Skip to content

Commit 8cc0dfe

Browse files
committed
使用whoosh之后解决了问题。
1 parent bb7b757 commit 8cc0dfe

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

DRFHTutorial/settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
For the full list of settings and their values, see
1010
https://docs.djangoproject.com/en/3.2/ref/settings/
1111
"""
12-
12+
import os
1313
from pathlib import Path
1414

1515
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -128,8 +128,8 @@
128128
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
129129

130130
HAYSTACK_CONNECTIONS = {
131-
"default": {
132-
# For Simple:
133-
"ENGINE": "haystack.backends.simple_backend.SimpleEngine"
131+
'default': {
132+
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
133+
'PATH': os.path.join(os.path.dirname(os.path.dirname(__file__)), 'Whoosh'),
134134
},
135135
}

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@
1818
![](https://github.com/cs246810/DRFHTutorial/blob/master/api_test.png)
1919

2020
结果有点差强人意,确实出现了结果,但是,这里出现的说text为null的数据,显然我没有找到正确的使用drf_haystack
21-
的方法。
21+
的方法。
22+
23+
后来我换上whoosh之后,居然奇迹般的出现了结果。
24+
25+
![](https://github.com/cs246810/DRFHTutorial/blob/master/whoosh.png)

whoosh.png

107 KB
Loading

0 commit comments

Comments
 (0)