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
5e24f36d
Commit
5e24f36d
authored
Sep 19, 2017
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'stable' into stable-imt
parents
89485bd5
1ae6b13b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
21 deletions
+78
-21
159a5154362b_fix_bug_in_title_abstract_indexation.py
...ions/159a5154362b_fix_bug_in_title_abstract_indexation.py
+52
-0
http.js
annotations/static/annotations/http.js
+9
-8
main.html
annotations/templates/annotations/main.html
+3
-3
gargantext_notebook.py
install/notebook/gargantext_notebook.py
+14
-10
No files found.
alembic/versions/159a5154362b_fix_bug_in_title_abstract_indexation.py
0 → 100644
View file @
5e24f36d
"""Fix bug in title_abstract indexation
Revision ID: 159a5154362b
Revises: 73112a361617
Create Date: 2017-09-18 18:00:26.055335
"""
from
alembic
import
op
import
sqlalchemy
as
sa
from
gargantext.util.alembic
import
ReplaceableObject
# revision identifiers, used by Alembic.
revision
=
'159a5154362b'
down_revision
=
'73112a361617'
branch_labels
=
None
depends_on
=
None
title_abstract_insert
=
ReplaceableObject
(
'title_abstract_insert'
,
'BEFORE INSERT'
,
'nodes'
,
"""FOR EACH ROW
WHEN (NEW.hyperdata::text <> '{}'::text)
EXECUTE PROCEDURE title_abstract_update_trigger()"""
)
title_abstract_update
=
ReplaceableObject
(
'title_abstract_update'
,
'BEFORE UPDATE OF hyperdata'
,
'nodes'
,
"""FOR EACH ROW
WHEN ((OLD.hyperdata ->> 'title', OLD.hyperdata ->> 'abstract')
IS DISTINCT FROM
(NEW.hyperdata ->> 'title', NEW.hyperdata ->> 'abstract'))
EXECUTE PROCEDURE title_abstract_update_trigger()"""
)
def
upgrade
():
op
.
replace_trigger
(
title_abstract_insert
,
replaces
=
"73112a361617.title_abstract_insert"
)
op
.
replace_trigger
(
title_abstract_update
,
replaces
=
"73112a361617.title_abstract_update"
)
# Manually re-build index
op
.
execute
(
"UPDATE nodes SET title_abstract = to_tsvector('english', (hyperdata ->> 'title') || ' ' || (hyperdata ->> 'abstract')) WHERE typename=4"
)
def
downgrade
():
# Won't unfix the bug !
pass
annotations/static/annotations/http.js
View file @
5e24f36d
...
...
@@ -7,6 +7,12 @@
$httpProvider
.
defaults
.
xsrfHeaderName
=
'X-CSRFToken'
;
$httpProvider
.
defaults
.
xsrfCookieName
=
'csrftoken'
;
}]);
function
url
(
path
)
{
// adding explicit "http[s]://" -- for cross origin requests
return
location
.
protocol
+
'//'
+
window
.
GARG_ROOT_URL
+
path
;
}
/*
* DocumentHttpService: Read Document
* ===================
...
...
@@ -98,9 +104,7 @@
*/
http
.
factory
(
'MainApiAddNgramHttpService'
,
function
(
$resource
)
{
return
$resource
(
// adding explicit "https://" b/c this a cross origin request
'https://'
+
window
.
GARG_ROOT_URL
+
"/api/ngrams?text=:ngramStr&corpus=:corpusId&testgroup"
,
url
(
"/api/ngrams?text=:ngramStr&corpus=:corpusId&testgroup"
),
{
ngramStr
:
'@ngramStr'
,
corpusId
:
'@corpusId'
,
...
...
@@ -131,9 +135,7 @@
http
.
factory
(
'MainApiChangeNgramHttpService'
,
function
(
$resource
)
{
return
$resource
(
// adding explicit "https://" b/c this a cross origin request
'https://'
+
window
.
GARG_ROOT_URL
+
"/api/ngramlists/change?list=:listId&ngrams=:ngramIdList"
,
url
(
"/api/ngramlists/change?list=:listId&ngrams=:ngramIdList"
),
{
listId
:
'@listId'
,
ngramIdList
:
'@ngramIdList'
// list in str form (sep=","): "12,25,30"
...
...
@@ -171,8 +173,7 @@
*/
http
.
factory
(
'MainApiFavoritesHttpService'
,
function
(
$resource
)
{
return
$resource
(
// adding explicit "https://" b/c this a cross origin request
'https://'
+
window
.
GARG_ROOT_URL
+
"/api/nodes/:corpusId/favorites?docs=:docId"
,
url
(
"/api/nodes/:corpusId/favorites?docs=:docId"
),
{
corpusId
:
'@corpusId'
,
docId
:
'@docId'
...
...
annotations/templates/annotations/main.html
View file @
5e24f36d
...
...
@@ -89,9 +89,9 @@
</div>
<div
class=
"row-fluid"
>
<ul
class=
"list-group clearfix"
>
<li
class=
"list-group-item small"
><span
class=
"badge"
>
source
</span>
{[{source}]}
</li>
<li
class=
"list-group-item small"
><span
class=
"badge"
>
authors
</span>
{[{authors}]}
</li>
<li
class=
"list-group-item small"
><span
class=
"badge"
>
date
</span>
{[{publication_date}]}
</li>
<li
class=
"list-group-item small"
><span
class=
"badge"
>
source
</span>
{[{source
|| '
'
}]}
</li>
<li
class=
"list-group-item small"
><span
class=
"badge"
>
authors
</span>
{[{authors
|| '
'
}]}
</li>
<li
class=
"list-group-item small"
><span
class=
"badge"
>
date
</span>
{[{publication_date
|| '
'
}]}
</li>
</ul>
</div>
...
...
install/notebook/gargantext_notebook.py
View file @
5e24f36d
...
...
@@ -16,7 +16,7 @@ django.setup()
from
gargantext.constants
import
QUERY_SIZE_N_MAX
,
get_resource
,
get_resource_by_name
from
gargantext.models
import
Node
,
ProjectNode
,
DocumentNode
from
gargantext.util.db
import
session
,
get_engine
from
gargantext.util.db
import
session
,
get_engine
,
func
from
collections
import
Counter
import
importlib
from
django.http
import
Http404
...
...
@@ -53,21 +53,25 @@ def scan_hal(request):
return
hal
.
scan_results
(
request
)
def
scan_gargantext
(
corpus_id
,
request
):
def
_search_docs
(
corpus_id
,
request
):
return
(
session
.
query
(
DocumentNode
)
.
filter
(
DocumentNode
.
parent_id
==
corpus_id
)
.
filter
(
DocumentNode
.
title_abstract
.
match
(
request
))
.
count
())
.
filter_by
(
parent_id
=
corpus_id
)
.
filter
(
Node
.
title_abstract
.
match
(
request
)))
def
scan_gargantext
(
corpus_id
,
request
):
return
(
_search_docs
(
corpus_id
,
request
)
.
with_entities
(
func
.
count
(
DocumentNode
.
id
.
distinct
()))
.
one
())[
0
]
def
scan_gargantext_and_delete
(
corpus_id
,
request
):
(
session
.
query
(
DocumentNode
)
.
filter
(
DocumentNode
.
parent_id
=
corpus_id
)
.
filter
(
DocumentNode
.
title_abstract
.
match
(
request
))
.
delete
(
synchronize_session
=
'fetch'
)
)
r
=
_search_docs
(
corpus_id
,
request
)
.
delete
(
synchronize_session
=
'fetch'
)
session
.
commit
()
return
r
def
myProject_fromUrl
(
url
):
"""
myProject :: String -> Project
...
...
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