Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Political Memory
memopol
Commits
53b0ea31
Commit
53b0ea31
authored
Apr 24, 2017
by
alexandre.jauneau
Browse files
Add whoosh for dev and test
parent
f306e5e7
Pipeline
#994
failed with stage
in 9 minutes and 7 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
53b0ea31
...
...
@@ -36,3 +36,4 @@ data/
# local setup
.memopol.alias
whoosh_index/
setup.py
View file @
53b0ea31
...
...
@@ -31,7 +31,8 @@ setup(name='political-memory',
'django-suit>=0.2,<0.3'
,
'psycopg2>=2,<3'
,
'django-haystack==2.6.0'
,
'pysolr==3.6.0'
'pysolr==3.6.0'
,
'Whoosh==2.7.4'
],
extras_require
=
{
# Full version hardcode for testing dependencies so that
...
...
src/memopol/settings.py
View file @
53b0ea31
...
...
@@ -344,11 +344,17 @@ if os.path.exists(RAVEN_FILE):
RAVEN_CONFIG
=
{
'dsn'
:
f
.
read
().
strip
()}
# Haystack with Solr config
DJANGO_HAYSTACK_ENABLE
=
True
if
DJANGO_HAYSTACK_ENABLE
:
if
not
DEBUG
:
HAYSTACK_CONNECTIONS
=
{
'default'
:
{
'ENGINE'
:
'haystack.backends.solr_backend.SolrEngine'
,
'URL'
:
'http://127.0.0.1:8080/solr'
,
},
}
else
:
HAYSTACK_CONNECTIONS
=
{
'default'
:
{
'ENGINE'
:
'haystack.backends.whoosh_backend.WhooshEngine'
,
'PATH'
:
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'whoosh_index'
),
},
}
src/memopol/views/representative_search.py
View file @
53b0ea31
...
...
@@ -7,7 +7,6 @@ from memopol.utils import strip_accents
def
search_autocomplete
(
request
):
if
request
.
is_ajax
():
q
=
strip_accents
(
request
.
GET
.
get
(
'term'
,
''
))
print
q
if
q
is
not
None
:
json_results
=
[]
sqs
=
SearchQuerySet
().
autocomplete
(
ascii_name
=
q
)
...
...
@@ -18,7 +17,6 @@ def search_autocomplete(request):
result_json
[
'value'
]
=
result
.
full_name
result_json
[
'link'
]
=
reverse
(
'representative-detail'
,
kwargs
=
{
'slug'
:
result
.
slug
})
json_results
.
append
(
result_json
)
print
result
.
ascii_name
data
=
json
.
dumps
(
json_results
)
else
:
data
=
"Fail"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment