Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
ff55b33a
Commit
ff55b33a
authored
Sep 01, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
csv reldb entries: allow specifying the delimiter
parent
9603a31f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
servermenu_config.md
00.DOCUMENTATION/A-Introduction/servermenu_config.md
+2
-0
db.json
db.json
+13
-1
info_div.php
twbackends/phpAPI/info_div.php
+13
-3
No files found.
00.DOCUMENTATION/A-Introduction/servermenu_config.md
View file @
ff55b33a
...
...
@@ -87,10 +87,12 @@ Expected type is `"csv"` and you should fill the columns to search in and the te
"csv"
:
{
"file"
:
"$$relpath/to/some.csv"
,
"qcols"
:
[
"list"
,
"of"
,
"cols"
,
"to"
,
"search"
,
"in"
,
"for"
,
"node0"
],
"delim"
:
";"
"template"
:
"bib_details"
}
}
```
NB: the delim parameter is optional (tab is used by default)
###### => for a cortext sql base
Expected type is
`"CortextDB"`
and you should fill the tables to search in.
...
...
db.json
View file @
ff55b33a
...
...
@@ -82,7 +82,19 @@
}
}
},
"test_with_various_atts.gexf"
:
{}
"ProgrammeDesCandidats.gexf"
:
{
"node0"
:
{
"name"
:
"term"
,
"reldbs"
:
{
"csv"
:
{
"file"
:
"ProgrammesCandidats2017.csv"
,
"delim"
:
","
,
"qcols"
:
[
"title"
,
"abstract"
,
"node0"
],
"template"
:
"bib_details"
}
}
}
}
}
},
"data/politoscope"
:
{
...
...
twbackends/phpAPI/info_div.php
View file @
ff55b33a
...
...
@@ -22,6 +22,7 @@ if ($dbtype == "CortextDB") {
else
{
// to index: the union of "searchable columns" qcols for all nodetypes
$idxcolsbytype
=
[];
$altcsvsep
=
$csvsep
;
for
(
$i
=
0
;
$i
<
$ntypes
;
$i
++
)
{
// if nodetype is active
...
...
@@ -36,6 +37,15 @@ else {
the CSV or DB table to query for related documents
(on nodetypeId "
.
$i
.
")</p>"
);
}
// optional conf items: separator
// FIXME: since conf is defined by node type,
// only the last separator will be taken into account
// but allowing two different separators contradicts
// the 1-base-per-graph structure in csv_indexation
if
(
array_key_exists
(
'delim'
,
$my_conf
[
"node"
.
$i
][
$dbtype
]))
{
$altcsvsep
=
$my_conf
[
"node"
.
$i
][
$dbtype
][
'delim'
];
}
}
}
...
...
@@ -69,12 +79,12 @@ else {
// echodump("filename CSV", $mainpath.$graphdb);
$csv_search_base
=
parse_and_index_csv
(
$mainpath
.
$graphdb
,
$idxcolsbytype
,
$csvsep
,
$csvquote
);
$
alt
csvsep
,
$csvquote
);
// -------------------------------------------------------------------------------
if
(
class_exists
(
'Memcached'
)){
// **store** in cache for
1/2h
$mcd
->
set
(
mem_entry_name
(
$graphdb
),
json_encode
(
$csv_search_base
),
1
80
0
);
// **store** in cache for
2 min
$mcd
->
set
(
mem_entry_name
(
$graphdb
),
json_encode
(
$csv_search_base
),
1
2
0
);
}
}
...
...
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