scijava / scijava-search

Search framework for SciJava applications :mag:
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

ImageScSearcher searches too often and it got me banned #29

Closed gselzer closed 1 year ago

gselzer commented 1 year ago

Here is the stack trace:

[WARNING] java.io.IOException: Server returned HTTP response code: 403 for URL: https://forum.image.sc/search/query.json?term=track+tags%3Aimagej
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1917)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1505)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
    at java.net.URL.openStream(URL.java:1093)
    at org.scijava.search.web.ImageScSearcher.search(ImageScSearcher.java:85)
    at org.scijava.search.DefaultSearchOperation$SearchAttempt.run(DefaultSearchOperation.java:181)
    at org.scijava.thread.DefaultThreadService.lambda$wrap$1(DefaultThreadService.java:211)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)

@ctrueden thinks we should throttle this searcher, only searching every X seconds.

hinerm commented 1 year ago

Are you sure this is searching too many times @gselzer? Is it more than once-per-keypress in the search bar? Did you confirm your ip was banned server-side?

I couldn't even do a single search.. e.g.:

This initially happened to me when I checked a previously-unchecked Image.sc Forum button in the search widget - which I would assume only triggered a single search with the current text (supported by the fact that I only got one exception).

ctrueden commented 1 year ago

I recently implemented Discourse topic search for my monoqueue tool, and I needed a Discourse API key, even for read-only search. I'm surprised the ImageScSearcher ever worked... I'll make a PRfix it.

ctrueden commented 1 year ago

Fixed by 7cda88619ea0a97ddf4681ba0ec357a6b14d5dba