Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
5d4880c6
Commit
5d4880c6
authored
5 years ago
by
Fredrik Jonsson
Browse files
Options
Downloads
Patches
Plain Diff
Fix syntax error in tsquery in search view by cleaning search query string.
parent
0f538a17
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentech/public/search/views.py
+6
-0
6 additions, 0 deletions
opentech/public/search/views.py
with
6 additions
and
0 deletions
opentech/public/search/views.py
+
6
−
0
View file @
5d4880c6
import
re
from
django.conf
import
settings
from
django.core.paginator
import
EmptyPage
,
PageNotAnInteger
,
Paginator
from
django.http
import
Http404
...
...
@@ -17,6 +19,10 @@ def search(request):
# Search
if
search_query
:
# Allow only word characters and spaces in search query.
words
=
re
.
findall
(
'
\w+
'
,
search_query
.
strip
())
search_query
=
'
'
.
join
(
words
)
public_site
=
request
.
site
.
root_page
search_results
=
Page
.
objects
.
live
().
descendant_of
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment