@socialgouv/cdtn-elasticsearch 1.8.10 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitlab-ci.yml CHANGED
@@ -6,7 +6,7 @@
6
6
  extends:
7
7
  - .autodevops_install
8
8
  - .cdtn_base_rules
9
- image: node:14.17.5-alpine3.11
9
+ image: node:14.18.0-alpine3.11
10
10
  needs:
11
11
  - job: 📦 logger
12
12
  artifacts: true
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@socialgouv/cdtn-elasticsearch",
3
3
  "description": "SocialGouv - Code du travail numerique - Infrastructure - Elasticsearch",
4
- "version": "1.8.10",
4
+ "version": "1.11.2",
5
5
  "babel": {
6
6
  "plugins": [
7
7
  "@babel/plugin-transform-modules-commonjs"
8
8
  ]
9
9
  },
10
10
  "dependencies": {
11
- "@socialgouv/cdtn-logger": "^1.8.10",
11
+ "@socialgouv/cdtn-logger": "^1.11.2",
12
12
  "got": "^11.8.2"
13
13
  },
14
14
  "license": "Apache-2.0",
@@ -25,11 +25,11 @@
25
25
  "url": "https://github.com/SocialGouv/cdtn-admin.git"
26
26
  },
27
27
  "devDependencies": {
28
- "@babel/core": "^7.15.0",
29
- "@babel/plugin-transform-modules-commonjs": "^7.14.5",
30
- "@socialgouv/eslint-config-recommended": "^1.84.2",
28
+ "@babel/core": "^7.15.5",
29
+ "@babel/plugin-transform-modules-commonjs": "^7.15.4",
30
+ "@socialgouv/eslint-config-recommended": "^1.88.0",
31
31
  "eslint": "^7.32.0",
32
- "jest": "^27.0.6",
32
+ "jest": "^27.1.1",
33
33
  "lint-staged": "^11.1.2",
34
34
  "prettier": "^2.3.2"
35
35
  },
@@ -46,5 +46,5 @@
46
46
  },
47
47
  "sideEffects": false,
48
48
  "typings": "src/index.d.ts",
49
- "gitHead": "12270782e3359ac68f846b0c9f3a8dadd6d9b2e6"
49
+ "gitHead": "eb963121a4a96b79fa47c2bbb764274bb9e31ac3"
50
50
  }
@@ -184,7 +184,6 @@
184
184
  "envers",
185
185
  "environ",
186
186
  "es",
187
- "essai",
188
187
  "est",
189
188
  "et",
190
189
  "etant",
@@ -83,6 +83,9 @@ exports.documentMapping = {
83
83
 
84
84
  folder: { type: "text" },
85
85
 
86
+ // html view for all documents
87
+ html: { type: "text" },
88
+
86
89
  // available for themes
87
90
  icon: { type: "keyword" },
88
91
 
@@ -131,6 +134,9 @@ exports.documentMapping = {
131
134
 
132
135
  publishedAt: { type: "date" },
133
136
 
137
+ // XML in JSON (available for fiche SP)
138
+ raw: { type: "text" },
139
+
134
140
  // available for themes and highlights
135
141
  refs: {
136
142
  properties: {
@@ -32,7 +32,7 @@ function preprocess(text) {
32
32
  }
33
33
 
34
34
  async function callTFServe(json) {
35
- const { body } = await got.post(tfServeURL, {
35
+ const response = await got.post(tfServeURL, {
36
36
  cache,
37
37
  json,
38
38
  responseType: "json",
@@ -41,7 +41,7 @@ async function callTFServe(json) {
41
41
  methods: ["POST"],
42
42
  },
43
43
  });
44
- return body["outputs"];
44
+ return response.body["outputs"];
45
45
  }
46
46
 
47
47
  async function vectorizeDocument(title, content) {
@@ -57,6 +57,7 @@ async function vectorizeDocument(title, content) {
57
57
  signature_name: "response_encoder",
58
58
  };
59
59
  const vectors = await callTFServe(body);
60
+
60
61
  return vectors[0];
61
62
  }
62
63
 
@@ -71,6 +72,7 @@ async function vectorizeQuery(query) {
71
72
  signature_name: "question_encoder",
72
73
  };
73
74
  const vectors = await callTFServe(body);
75
+ console.log("vectors lenght", vectors.length);
74
76
  return vectors[0];
75
77
  }
76
78