zquestz / s

Open a web search in your terminal.
MIT License
2.35k stars 114 forks source link

Added provider arxiv.org #54

Closed lkhamsurenl-zz closed 8 years ago

lkhamsurenl-zz commented 8 years ago

Arxiv.org is a repo for e-prints, very useful for searching scientific papers.

KeizerDev commented 8 years ago

LGTM

zquestz commented 8 years ago

So the site supports OR, but we are not leveraging that. Going to look at this a bit closer.

zquestz commented 8 years ago

If you go there and do "phrase OR phrase" then that works as expected, but this provider does not support that.

zquestz commented 8 years ago

For instance:

http://arxiv.org/find/all/1/all:+OR+blue+green+AND+red/0/1/0/all/0/1

KeizerDev commented 8 years ago

This is working to: http://arxiv.org/find/all/1/all:{query}/0/1/0/all/0/1

lkhamsurenl-zz commented 8 years ago

Yes you can do or operation if you want, I assume that most of the time people would just search for exact phrase like: Deep convolutional network. We can add support for or in future if people request, what do you guys think?

KeizerDev commented 8 years ago

Why not just type:

$ s "blue OR green AND red" -p arxiv
KeizerDev commented 8 years ago

@lkhamsurenl sure, but you did include that in the code so that is where the confusion is from.

zquestz commented 8 years ago

@KeizerDev: with this PR that won't work. Thats what I was commenting on. Right now it only supports AND which seems ok as a first pass.

KeizerDev commented 8 years ago

@zquestz: Ikr

lkhamsurenl-zz commented 8 years ago

I personally do not think it's user friendly to allow users to manually enter AND or OR ops in the query. For instance:

  1. To search "deep learning", would have to enter "(deep AND learning)"
  2. To search "deep learning or machine learning", they would enter "(deep AND learning) OR (machine AND learning)"

We might be able to parse the query to enter AND into the query, but what if the user was searching for exact query with or in the query (but they did not intend to mean it's optional).

zquestz commented 8 years ago

I was thinking that without an operator we default to AND, but then use OR if specified.

So "deep learning" would work fine. Or you can do "deep learning or machine learning"

zquestz commented 8 years ago

Actually for the first pass this is fine. I can live. We can extend to an OR operator if anyone wants it in a subsequent PR. Thanks for the contribution!

lkhamsurenl-zz commented 8 years ago

Yep that might be the best solution. The only thing I can think of is in case user was searching for exact phrase with word or in it, like "Human computer interaction in space or in water". We would make it optional. But I think it'd still return the exact matching phrase as one of the search answers, since all we're doing is just making it optional. I can update PR with the changes :)

zquestz commented 8 years ago

So the one thing I do want for this provider is some basic tests. I know we haven't tested most providers but this one actually has some logic that deserves a basic test or two.

lkhamsurenl-zz commented 8 years ago

Very good point. I've updated the PR with test cases and support for the "or" operation. Please let me know if you see any issue.

zquestz commented 8 years ago

The syntax they use is super weird, but this is looking good. Thanks for the contribution and the test!

lkhamsurenl-zz commented 8 years ago

I know right? Thank YOU for the great tool, I love it!