-
Notifications
You must be signed in to change notification settings - Fork 69
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
receivers: implement autocomplete #3006
Conversation
0eab17c
to
6f087d0
Compare
@@ -281,6 +281,9 @@ | |||
}, | |||
"volume": { | |||
"type": "string" | |||
}, | |||
"book_series_suggest": { |
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.
Since, this field is inside book_series
, adding the prefix book_series
is duplicating information.
I would suggest having that solely as suggest
.
@@ -310,6 +313,9 @@ | |||
}, | |||
"value": { | |||
"type": "string" | |||
}, | |||
"collaboration_suggest": { |
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.
Same goes for this field.
@@ -292,7 +354,8 @@ def populate_abstract_source_suggest(sender, json, *args, **kwargs): | |||
|
|||
|
|||
def populate_title_suggest(sender, json, *args, **kwargs): | |||
"""Populate the ``title_suggest`` field of Journals records.""" | |||
"""Populate the ``title_suggest`` field of |
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.
Nit: formatting
5ab546a
to
2f8863a
Compare
@@ -79,6 +79,10 @@ | |||
"conferenceautocomplete": { |
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.
should this still be used after this PR (I have no idea)? if not you should remove it.
@@ -132,6 +132,10 @@ | |||
"experimentautocomplete": { |
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.
same comment.
@@ -148,7 +153,7 @@ def enhance_after_index(sender, json, *args, **kwargs): | |||
|
|||
|
|||
def populate_bookautocomplete(sender, json, *args, **kwargs): |
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.
so what's the difference between *autocomplete
and *_suggest
? if there is none, the names should probably made consistent one way or another.
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.
@michamos we will stick to the *_suggest
as this is the proper way of implementing the suggesters. We will also remove all *autocomplete
suggesters.
return | ||
|
||
doc_types = json.get('document_type', []) | ||
if all(doc_type not in doc_types for doc_type in ['book', 'thesis', 'proceedings']): |
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.
I find if not set(doc_types) & {'book', 'thesis', 'proceedings'}
clearer.
'title': titles, | ||
}, | ||
}, | ||
}) | ||
|
||
|
||
def populate_book_series_suggest(sender, json, *args, **kwargs): |
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.
there seems to be a book series autocomplete in the submission forms. It is broken however, as it autocompletes from all journals, instead of only those having book_series=True
combined with the book series in Literature records. Can you check whether you can salvage that one instead of creating a new one?
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.
@michamos I would say that we should probably try to use this one in oreder to have consistent suggesters and remove the old one. @jacquerie, @harunurhan ? Also, the old one seems overly-complicated and confusing I would say.
'title': titles, | ||
}, | ||
}, | ||
}) | ||
|
||
|
||
def populate_book_series_suggest(sender, json, *args, **kwargs): | ||
"""Populate the ``book_series.book_series_suggest`` field of Literature records.""" | ||
if 'hep.json' not in json.get('$schema'): |
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.
is this really one should check for a given record type (cc @jacquerie)? I would expect there to be a helper somewhere that gets you the type from the record. If not, it should probably exist.
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.
|
||
json.update({ | ||
'conference_suggest': { | ||
'input': cnum, |
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.
autocompleting on cnum
is not very useful: either you already know it and you can type it out, or you don't and you won't learn anything from the list of suggestions. You should add more information from the conference record:
acronyms
, address
, series.name
, titles
, opening_date
.
|
||
input_values = [] | ||
input_values.append(legacy_name) | ||
input_values.append(long_name) |
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.
I would rather do input_values = [legacy_name, long_name]
@@ -306,14 +417,17 @@ def populate_title_suggest(sender, json, *args, **kwargs): | |||
input_values.extend(title_variants) |
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.
same story
This is probably relevant: https://github.com/inveniosoftware/invenio/wiki/Invenio-Sprint-Reviews#completion-suggesters |
@michamos should we change to the V5 way of doing things that uses |
not my decision :) @jacquerie ? |
If you remove the payload, it will be a breaking change. For |
bda7ccf
to
fb97a92
Compare
@@ -170,20 +175,106 @@ def populate_bookautocomplete(sender, json, *args, **kwargs): | |||
input_values.extend(titles) | |||
input_values = [el for el in input_values if el] | |||
|
|||
ref = get_value(json, 'self.$ref') | |||
record = get_value(json, 'self.$ref', '') | |||
|
|||
json.update({ | |||
'bookautocomplete': { | |||
'input': input_values, | |||
'payload': { | |||
'authors': authors, |
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.
@michamos I need more indications for bookautocomplete
. Currently it has no output
and we need to decide on it and what should be in the payload, right @harunurhan ?
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.
input seems fine, output for parent_isbn
should be isbns.value[0]
.
Includes also and closes: #2795 |
e7d7b33
to
32460aa
Compare
Includes and closes #2837 |
This doesn't work: annotations like "(c|C)loses #XXX" only take effect if they are part of the first message of the PR (#3006 (comment)) or as part of any commit. See: https://help.github.com/articles/closing-issues-using-keywords/. |
6b5853e
to
482fb69
Compare
Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
Added unit tests for hep records suggesters: collaboration_suggest and bokk_series_suggest, and for experiments records experiment_suggest suggester. Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
Added 'long_name' and 'name_variants' to the input of experiment_suggest. Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
So far, even if a record has several report numbers associated with it, the output will contain only the first one. Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
…mplete` Signed-off-by: Iuliana Voinea <[email protected]>
The autocompletion is now done using a completion suggester. `experiment_suggest`. Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
I replaced the old `conferenceautocomplete` with `conference_suggest`. Also, there was a bug in the JavaScript which called the `conference_suggest` endpoint every time the submission form was laoded, which I also hopefully fixed. Lastly, I removed some commented/unused autocompletion functions from the forms module and added `TODO`. comments which mention the fact that we need a consistent way of performing autocompletion (with ES compeltion suggeters), instead of using the old way this was implemented in `INSPIREForm`. Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
Signed-off-by: Iuliana Voinea <[email protected]>
Some acceptance tests for conference and advisors autocompletion were failing and I had to modify them. This is due to the fact that when trying to autocomplete for the conference However, for an author |
7bb48e2
to
92ed6f0
Compare
Signed-off-by: Iuliana Voinea <[email protected]>
92ed6f0
to
3afcd77
Compare
Description
Implemented the back-end for autocompletion using ES completion type suggesters for several required fields.
Related Issue
inspirehep/record-editor#261
closes #2755
Motivation and Context
Needed for the front-end implementation of the autocompletion..
Checklist:
RFC
and look for it).