Error editing Edition: Unable to add author
Tried to add the author "Harry F. Olson" to https://openlibrary.org/books/OL24239544M/Elements_of_acoustical_engineering/edit and received error"expected /type/author, found /type/delete":
That's due to a stale search index which is returning a deleted record. Try Harry Ferdinand Olson.
I tried to reproduce this and ended up with the author that @tfmorris suggested, so it worked. I look at the number of works listed by each author in the drop down and choose the one with the most.
I think the error was occurring when https://openlibrary.org/authors/OL7017081A.json was selected, which is a delete type.
This is one reason redirects are better than deletes, but I think the error message was correct in this case. The stale search index is still a problem, but should there be a fix to make the messaging clearer?
Perhaps the dropdown should be filtered to remove redirects and deletes? I feel like this has been discussed before.
@hornc What did you use for your search/autocomplete string?
I was able to reproduce Jeff's problem, which I should have stated up front, using his search string (ie with just the middle initial) and only a single choice was offered. Since then I merged a couple of the other author records and that apparently had the side effect of indexing the "Harry F." aka, so that it now is the top autocomplete option.
If you go to the second search option, you still see the same problem that Jeff reported.
As for filtering out deleted records goes, that's a good suggestion, but probably depends on the SOLR search results being accurate and not stale, which I suspect is not the case in this instance (but I didn't check directly).
@tfmorris good question, I may have used "Harry Olson" to maximise my chances of finding the correct author by hoping to see all "Harry Olson"s , and if there was more than one, I'd pick the one with F. or Ferdinand. If I try again though, tying or pasting "Harry F. Olson" shows "Harry Ferdinand Olson" as the first option, followed by "Harry F. Olson"
@hornc if this is not a bug, can you describe what needs to be done to close the issue?
I think there are two possible fixes for this issue:
- Tidy up the reported error message to be more human readable OR (clearly better)
- Filter results to ensure only direct author records are presented in the dropdown
(best) Longer term root cause fix is to ensure solr index is up to date and reflects the current state of all author records
@cdrini, are you aware of an existing mechanism to check and filter the solr results to exclude redirects and deletes before they get passed to the UI?
I'm wondering if the fix here is simply to fix the indexing process, because what is the point of having Solr if all its results have to be individually checked for accuracy before being used?
I'm wondering if the fix here is simply to fix the indexing process, because what is the point of having Solr if all its results have to be individually checked for accuracy before being used?
Congrats, @hornc, you've invented a Bloom Filter. :smile:
Solr shouldn't have redirects inside it, so you'd have to take the query results and load the live items from the database. This would probably be super not performant for something like autocomplete :/
I think the ideal solution might be to follow the redirect. i.e. If I try to set an author to be a redirect, it should set it to be the direct value.
In the case of a deletion, a better error message.
@hornc There hasn't been progress on this in 4 months so I'm labeling it as backlogged. Let me know your thoughts.
@tapaswenipathak Feel free to fork and take a stab at solving this issue and reporting back in this thread.
Related or duplicate of https://github.com/internetarchive/openlibrary/issues/1445?
They both seem to be related to /type/redirect/ but I don't see mention of /type/direct in #1445 so perhaps they are different issues. I'm not too sure though
Thanks @seabelis , I think you are correct that this will be at least improved by #1445
From re-reading this thread, I think the immediate fix and task to resolve the issue as reported is to filter out /type/delete's and /type/redirect`s from the author auto-complete drop-down. code @ https://github.com/internetarchive/openlibrary/blob/master/openlibrary/templates/books/author-autocomplete.html @tapaswenipathak if you still are able to take a look at the js here that would be super helpful!
This issue is a very specific error: A specific book could not be edited. The book record looks correct.
It's unclear what someone would do to close this issue. If we need a more specific issue created, let's please do so. I'm going to close @JeffKaplan's ticket (the thread preserves the context).