Repository navigation
[text-lucene] create service #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8aeb115
feat(text-lucene): create service
leogail ee2710e
feat(text-lucene): Use ilaas git secret as venv
leogail 6e2f527
feat(text-lucene): add base code
leogail 7135696
Apply suggestions from code review
leogail fce88a8
fix(text-lucene): now, there is the expand id everytime
leogail ef23ff4
test(text-lucene): update tests (not reproductibles res)
leogail 27188d4
docs(text-lucene): add modif from review
leogail 881e9dc
release ws-text-lucene@1.0.0
leogail 71217b6
chore(text-lucene): update port
leogail File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Ignore all files by default | ||
| * | ||
|
|
||
| # White list only the required files | ||
| !config.json | ||
| !v1 | ||
| !swagger.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # syntax=docker/dockerfile:1.2 | ||
| FROM cnrsinist/ezs-python-server:py3.9-no24-1.0.13 | ||
|
|
||
| WORKDIR /app | ||
| # Install all python dependencies | ||
| RUN pip install --no-cache-dir \ | ||
| requests==2.32.5 | ||
|
|
||
| WORKDIR /app/public | ||
| # Declare files to copy in .dockerignore | ||
| COPY --chown=daemon:daemon . /app/public/ | ||
| COPY --chown=daemon:daemon ./config.json /app/config.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # ws-text-lucene@1.0.0 | ||
|
|
||
| Assistance à la génération de requête dans Istex Search | ||
|
|
||
| Génère une requête en syntaxe Lucene à partir d'une requête en langue naturelle (multilingue). C'est la syntaxe utilisée par Istex Search (et par l'API Istex). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "environnement": { | ||
| "EZS_TITLE": "Assistance à la génération de requête dans Istex Search", | ||
| "EZS_DESCRIPTION": "Génère une requête en syntaxe Lucene à partir d'une requête en langue naturelle (multilingue)", | ||
| "EZS_METRICS": true, | ||
| "EZS_CONCURRENCY": 2, | ||
| "EZS_CONTINUE_DELAY": 60, | ||
| "EZS_NSHARDS": 32, | ||
| "EZS_CACHE": true, | ||
| "EZS_VERBOSE": false, | ||
| "NODE_OPTIONS": "--max_old_space_size=1024", | ||
| "NODE_ENV": "production", | ||
| "ILAAS_API_KEY": "real_api_key" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # These examples can be used directly in VSCode, using HTTPYac extension (anweber.vscode-httpyac) | ||
| # They are important, because used to generate the tests.hurl file. | ||
|
|
||
| # Décommenter/commenter les lignes voulues pour tester localement | ||
| @host=http://localhost:31976 | ||
| # @host=https://text-lucene.services.istex.fr | ||
|
|
||
| ### | ||
| # @name v1IstexSearch | ||
| # Construit une requête syntaxe Lucene à partir d'une requête en langue naturelle (quelle que soit la langue). | ||
| POST {{host}}/v1/istex-search?indent=true HTTP/1.1 | ||
| Content-Type: application/json | ||
|
|
||
| [ | ||
| { | ||
| "value": "Je veux un corpus d'articles scientifiques publiés post 2020 sur la biodiversité dans la méditerranée nord. Les documents seront en anglais" | ||
| }, | ||
| { | ||
| "value": "no query" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| { | ||
| "private": true, | ||
| "name": "ws-text-lucene", | ||
| "version": "1.0.0", | ||
| "description": "Assistance à la génération de requête dans Istex Search", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/Inist-CNRS/web-services.git" | ||
| }, | ||
| "keywords": [ | ||
| "ezmaster" | ||
| ], | ||
| "author": "Léo Gaillard <leo.gaillard@cnrs.fr>", | ||
| "license": "MIT", | ||
| "bugs": { | ||
| "url": "https://github.com/Inist-CNRS/web-services/issues" | ||
| }, | ||
| "homepage": "https://github.com/Inist-CNRS/web-services/#readme", | ||
| "scripts": { | ||
| "version:insert:readme": "sed -i \"s#\\(${npm_package_name}.\\)\\([\\.a-z0-9]\\+\\)#\\1${npm_package_version}#g\" README.md && git add README.md", | ||
| "version:insert:swagger": "sed -i \"s/\\\"version\\\": \\\"[0-9]\\+.[0-9]\\+.[0-9]\\+\\\"/\\\"version\\\": \\\"${npm_package_version}\\\"/g\" swagger.json && git add swagger.json", | ||
| "version:insert": "npm run version:insert:readme && npm run version:insert:swagger", | ||
| "version:commit": "git commit -a -m \"release ${npm_package_name}@${npm_package_version}\"", | ||
| "version:tag": "git tag \"${npm_package_name}@${npm_package_version}\" -m \"${npm_package_name}@${npm_package_version}\"", | ||
| "version:push": "git push && git push --tags", | ||
| "version": "npm run version:insert && npm run version:commit && npm run version:tag", | ||
| "postversion": "npm run version:push", | ||
| "build:check": "DOCKER_BUILDKIT=1 docker build --check -t cnrsinist/${npm_package_name}:latest . && docker run --rm -i hadolint/hadolint hadolint - < Dockerfile ", | ||
| "build:dev": "docker build -t cnrsinist/${npm_package_name}:latest .", | ||
| "start:dev": ". ./.env 2> /dev/null; npm run build:dev && docker run -e ILAAS_API_KEY --name dev --rm --detach -p 31976:31976 cnrsinist/${npm_package_name}:latest", | ||
| "stop:dev": "docker stop dev", | ||
| "build": "docker build -t cnrsinist/${npm_package_name}:${npm_package_version} .", | ||
| "start": "docker run --rm -p 31976:31976 cnrsinist/${npm_package_name}:${npm_package_version}", | ||
| "publish": "docker push cnrsinist/${npm_package_name}:${npm_package_version}" | ||
| }, | ||
| "avoid-testing": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "openapi": "3.0.0", | ||
| "info": { | ||
| "title": "text-lucene - Assistance à la génération de requête dans Istex Search", | ||
| "description": "Génère une requête en syntaxe Lucene à partir d'une requête en langue naturelle (multilingue)", | ||
| "version": "1.0.0", | ||
| "termsOfService": "https://services.istex.fr/", | ||
| "contact": { | ||
| "name": "Inist-CNRS", | ||
| "url": "https://www.inist.fr/nous-contacter/" | ||
| } | ||
| }, | ||
| "servers": [ | ||
| { | ||
| "x-comment": "Will be automatically completed by the ezs server." | ||
| }, | ||
| { | ||
| "url": "http://vptdmservices.intra.inist.fr:49376/", | ||
| "description": "Latest version for production", | ||
| "x-profil": "Standard" | ||
| } | ||
| ], | ||
| "tags": [ | ||
| { | ||
| "name": "text-lucene", | ||
| "description": "Assistance à la génération de requête dans Istex Search", | ||
| "externalDocs": { | ||
| "description": "Plus de documentation", | ||
| "url": "https://github.com/inist-cnrs/web-services/tree/main/services/text-lucene" | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| POST {{host}}/v1/istex-search?indent=true | ||
| content-type: application/json | ||
| [ | ||
| { | ||
| "value": "Je veux un corpus d'articles scientifiques publiés post 2020 sur la biodiversité dans la méditerranée nord. Les documents seront en anglais" | ||
| }, | ||
| { | ||
| "value": "no query" | ||
| } | ||
| ] | ||
|
|
||
|
|
||
| HTTP 200 | ||
| Content-Type: application/json | ||
| [Asserts] | ||
| jsonpath "$[0].value" contains "title:(" | ||
| jsonpath "$[0].value" contains "abstract:(" | ||
| jsonpath "$[0].value" contains "language.raw:" | ||
| jsonpath "$[0].value" matches /^.{100,1100}$/ | ||
| jsonpath "$[1].value" exists | ||
| jsonpath "$[1].value" matches /^.{0,10}$/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # OpenAPI Documentation - JSON format (dot notation) | ||
| mimeType = application/json | ||
|
|
||
| post.operationId = post-v1-istex-search | ||
| post.summary = Assistance à la génération de requête Lucene dans Istex Search | ||
| post.description = Génère une requête en syntaxe Lucene a partir d'une requête en langue naturelle (service multilingue) | ||
| post.tags.0 = text-lucene | ||
| post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream | ||
| post.requestBody.required = true | ||
| post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream | ||
| post.responses.default.description = Le champ `value` contient la requête Lucene générée | ||
| post.parameters.0.description = Indenter le JSON résultant | ||
| post.parameters.0.in = query | ||
| post.parameters.0.name = indent | ||
| post.parameters.0.schema.type = boolean | ||
|
|
||
| # Examples | ||
| post.requestBody.content.application/json.example.0.value = Je veux un corpus d'articles scientifiques publiés post 2020 sur la biodiversité dans la méditerranée nord. Les documents seront en anglais | ||
| post.requestBody.content.application/json.example.1.value = no query | ||
| post.responses.default.content.application/json.example.0.value = (title:("biodiversity" "marine biodiversity" "ocean biodiversity" "oceanic biodiversity") OR abstract:("biodiversity" "marine biodiversity" "ocean biodiversity" "oceanic biodiversity") OR subject.value:("biodiversity" "marine biodiversity" "ocean biodiversity" "oceanic biodiversity")) AND (title:("north mediterranean" "north mediterranean sea") OR abstract:("north mediterranean" "north mediterranean sea") OR subject.value:("north mediterranean" "north mediterranean sea")) AND language.raw:("eng") AND genre.raw:"research-article" AND publicationDate:[2020 TO *] | ||
| post.responses.default.content.application/json.example.1.value = | ||
|
|
||
| [use] | ||
| plugin = @ezs/spawn | ||
| plugin = @ezs/basics | ||
|
|
||
| [JSONParse] | ||
| separator = * | ||
|
|
||
| [expand] | ||
| path = value | ||
| size = 5 | ||
|
|
||
| [expand/exec] | ||
| # command should be executable ! | ||
| command = ./v1/istex-search.py | ||
|
|
||
| [dump] | ||
| indent = env('indent', false) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🪳 : nitpick (non-blocking): Bizarre.
D'où ça vient ?!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aucune idée, j'ai pourtant bien exécuté un pull avant de créer la branche..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai eu la même chose en créant une autre branche #409 (depuis la branche
mainà jour).Étrange.