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
d015a3d5
Commit
d015a3d5
authored
Sep 08, 2015
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Advanced chart: can filter with not in abstract.
parent
b585f4ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
api.py
gargantext_web/api.py
+13
-10
gargantext.angular.js
static/js/gargantext.angular.js
+3
-1
No files found.
gargantext_web/api.py
View file @
d015a3d5
...
...
@@ -3,7 +3,7 @@ from django.core.exceptions import PermissionDenied, SuspiciousOperation
from
django.core.exceptions
import
ValidationError
from
django.core.urlresolvers
import
reverse
from
sqlalchemy
import
text
,
distinct
,
or_
from
sqlalchemy
import
text
,
distinct
,
or_
,
not_
from
sqlalchemy.sql
import
func
from
sqlalchemy.orm
import
aliased
...
...
@@ -67,15 +67,16 @@ class APIException(_APIException):
_operators_dict
=
{
"="
:
lambda
field
,
value
:
(
field
==
value
),
"!="
:
lambda
field
,
value
:
(
field
!=
value
),
"<"
:
lambda
field
,
value
:
(
field
<
value
),
">"
:
lambda
field
,
value
:
(
field
>
value
),
"<="
:
lambda
field
,
value
:
(
field
<=
value
),
">="
:
lambda
field
,
value
:
(
field
>=
value
),
"in"
:
lambda
field
,
value
:
(
or_
(
*
tuple
(
field
==
x
for
x
in
value
))),
"contains"
:
lambda
field
,
value
:
(
field
.
contains
(
value
)),
"startswith"
:
lambda
field
,
value
:
(
field
.
startswith
(
value
)),
"="
:
lambda
field
,
value
:
(
field
==
value
),
"!="
:
lambda
field
,
value
:
(
field
!=
value
),
"<"
:
lambda
field
,
value
:
(
field
<
value
),
">"
:
lambda
field
,
value
:
(
field
>
value
),
"<="
:
lambda
field
,
value
:
(
field
<=
value
),
">="
:
lambda
field
,
value
:
(
field
>=
value
),
"in"
:
lambda
field
,
value
:
(
or_
(
*
tuple
(
field
==
x
for
x
in
value
))),
"contains"
:
lambda
field
,
value
:
(
field
.
contains
(
value
)),
"doesnotcontain"
:
lambda
field
,
value
:
(
not_
(
field
.
contains
(
value
))),
"startswith"
:
lambda
field
,
value
:
(
field
.
startswith
(
value
)),
}
_hyperdata_list
=
[
hyperdata
...
...
@@ -117,6 +118,8 @@ class NodesChildrenNgrams(APIView):
ngrams_query
=
ngrams_query
.
filter
(
Ngram
.
terms
.
startswith
(
request
.
GET
[
'startwith'
]))
if
'contain'
in
request
.
GET
:
ngrams_query
=
ngrams_query
.
filter
(
Ngram
.
terms
.
contains
(
request
.
GET
[
'contain'
]))
#if 'doesnotcontain' in request.GET:
# ngrams_query = ngrams_query.filter(not_(Ngram.terms.contains(request.GET['doesnotcontain'])))
# pagination
offset
=
int
(
request
.
GET
.
get
(
'offset'
,
0
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
20
))
...
...
static/js/gargantext.angular.js
View file @
d015a3d5
// Pre-defined constants
var
operators
=
{
'text'
:
[
{
'label'
:
'contains'
,
'key'
:
'contains'
}
{
'label'
:
'contains'
,
'key'
:
'contains'
},
{
'label'
:
'does not contain'
,
'key'
:
'doesnotcontain'
},
],
'string'
:
[
{
'label'
:
'starts with'
,
'key'
:
'startswith'
},
{
'label'
:
'contains'
,
'key'
:
'contains'
},
{
'label'
:
'does not contain'
,
'key'
:
'doesnotcontain'
},
{
'label'
:
'ends with'
,
'key'
:
'endswith'
},
{
'label'
:
'is'
,
'key'
:
'='
},
{
'label'
:
'is before'
,
'key'
:
'<'
},
...
...
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