Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
1a76e303
Commit
1a76e303
authored
Sep 14, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use indexed fulltext search in notebook
parent
cc7461f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
gargantext_notebook.py
install/notebook/gargantext_notebook.py
+6
-10
No files found.
install/notebook/gargantext_notebook.py
View file @
1a76e303
...
...
@@ -15,7 +15,7 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gargantext.settings')
django
.
setup
()
from
gargantext.constants
import
QUERY_SIZE_N_MAX
,
get_resource
,
get_resource_by_name
from
gargantext.models
import
ProjectNode
,
DocumentNode
from
gargantext.models
import
Node
,
ProjectNode
,
DocumentNode
from
gargantext.util.db
import
session
,
get_engine
from
collections
import
Counter
import
importlib
...
...
@@ -53,15 +53,11 @@ def scan_hal(request):
return
hal
.
scan_results
(
request
)
def
scan_gargantext
(
corpus_id
,
lang
,
request
):
connection
=
get_engine
()
.
connect
()
# TODO add some sugar the request (ideally request should be the same for hal and garg)
query
=
"""select count(n.id) from nodes n
where to_tsvector('
%
s', hyperdata ->> 'abstract' || 'title')
@@ to_tsquery('
%
s')
AND n.parent_id =
%
s;"""
%
(
lang
,
request
,
corpus_id
)
return
[
i
for
i
in
connection
.
execute
(
query
)][
0
][
0
]
connection
.
close
()
def
scan_gargantext
(
corpus_id
,
request
):
return
(
session
.
query
(
DocumentNode
)
.
filter_by
(
parent_id
=
corpus_id
)
.
filter
(
Node
.
title_abstract
.
match
(
request
))
.
count
())
def
myProject_fromUrl
(
url
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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