Skip to content
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

Cache filenames too long #39

Closed
juanfcocontreras opened this issue Jul 27, 2017 · 4 comments
Closed

Cache filenames too long #39

juanfcocontreras opened this issue Jul 27, 2017 · 4 comments

Comments

@juanfcocontreras
Copy link
Contributor

juanfcocontreras commented Jul 27, 2017

When the query is too long, the module fails when saving cache results:

[Errno 63] File name too long

The issue is in scopus_search.py:

qfile = os.path.join(SCOPUS_SEARCH_DIR,
                             # We need to remove / in a DOI here so we can save
                             # it as a file.
                             query.replace('/', '_slash_'))

[...]

with open(qfile, 'wb') as f:

Could the cache filename be shortened, or at least, truncated?

@Michael-E-Rose
Copy link
Contributor

Thanks for the catch! I guess this is the same as in #6.

I think the best is to not cache the search (i.e. not create a file at all). Otherwise there is no way recovering the search from a truncated filename.

In the meantime I close this one as duplicate and come up with a solution in the next few days.

@juanfcocontreras
Copy link
Contributor Author

I think that a hash approach should be considered.

In my case, the complex search also involves a long result and the cache mechanism is very handy. The probability of collision in long searches should be very low.

Anyway, I think a parameter to control the creation or not of cache result is always useful.

Thanks!

@Michael-E-Rose
Copy link
Contributor

A hash approach is actually a very good idea! Would you be able to contribute? This would be most wonderful!

Regarding the create file-parameter I think it might clash with the logic of the refresh parameter.

@juanfcocontreras
Copy link
Contributor Author

Sure, here it is:

#40

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants