Comments (13)
It's AND, yes. Does it make sense to support OR on API level? What if you just performed multiple queried and then combined the results?
from api.
I suppose that support for OR
is not absolutely necessary. But it is convenient in some situations.
To make multiple queries and to combine results is a possible approach. But it leads to extra request(s) which may cause growth of burden for network and server.
from api.
Ok. Can you propose an approach? What it would look like on API level?
from api.
One way is to make it by using some special parameter. Maybe it is not the best way but at least it should be quite simple and understandable (I hope).
from api.
What it would look like on API level?
http://api.jsdelivr.com/v2/jsdelivr/libraries?or(name=*jquery*+description=*jquery*+mainfile=*jquery*)¬(name=jquery)
Should find all repos that use jQuery, but is not the jQuery distro itself.
Could use ,
as a deliminator instead of +
(my preference is ,
but I used the jsDelivr multifile API. Perhaps always use wildcard search for long fields like description
? Also, prose fields like URLs & description
need to be lowercased.
Sound good?
from api.
oops, had to fix my API example
from api.
I like this proposal.
Maybe ,
as a separator is more readable.
from api.
http://api.jsdelivr.com/v2/jsdelivr/libraries?or(name=*jquery*+description=*jquery*+mainfile=*jquery*)¬(name=jquery)
Should find all repos that use jQuery, but is not the jQuery distro itself.
Why would you want to exclude jQuery distro?
If we want to get away with the least effort, we can do just op=or
to override default. Less API to remember and easier to implement but that won't be as powerful as what you are suggesting. This would look something like this:
http://api.jsdelivr.com/v2/jsdelivr/libraries?op=or&name=*jquery*&description=*jquery*&mainfile=*jquery*
In addition you would filter out jquery
library itself on client side to match your use case. This seems like a special case to me and I'm not entirely convinced yet it would be a good idea to provide it on the API level. A lot added of complexity for little benefit.
from api.
I agree with op=or
approach if it can be implemented without considerable efforts.
from api.
@gamtiq It's a very small change. Given it's backwards compatible I can add it to v1
API even.
@tomByrer What do you think?
from api.
Honestly, I find the op=or
harder to read; does op=or&name=*jquery*&description=*jquery*&mainfile=*jquery*
mean
SELECT *
FROM libraries
WHERE name LIKE '%jquery%' OR description LIKE '%jquery%' AND mainfile LIKE '%jquery%'
or
SELECT name, description, mainfile
FROM libraries
WHERE (name LIKE '%jquery%' AND description LIKE '%jquery%') OR (name LIKE '%jquery%' AND mainfile LIKE '%jquery%'
?
If parens are added to op=or
then that will be easier to read by eyes, but if that is slower in server &/or client, then please do what is most efficient. Either way, thanks for asking for feedback!
NOT seems like a special case
If too much work, don't bother please :)
from api.
op=or
changes default behavior to OR so instead of having AND for all you get OR. So in case any of the query parameters matches, it will be returned.
It would be a very easy change to make. Just wondering if it would be useful.
@gamtiq Would that help in your use case?
from api.
I suppose that would be enough and quite useful.
from api.
Related Issues (20)
- Version sorting HOT 10
- API returns no versions (urgent) HOT 5
- Move the API away from AppFog HOT 8
- Am I right to assume that I cannot get data for multiple librarys with one api call? HOT 4
- Searching by URL HOT 1
- jQuery failed to update latest beta1 HOT 2
- File paths HOT 14
- Incorrect author format for some CDNJS projects HOT 3
- pagination need? HOT 3
- The result order is not right HOT 3
- Default filename for specified version HOT 8
- API is not detecting new projects HOT 2
- Specify Content Security Policy? HOT 1
- API future HOT 3
- Add SRI to API HOT 1
- Add a download/hit count to the API HOT 7
- API endpoint down? HOT 2
- "bootstrap" alias is gone in v1 HOT 7
- Remove X-Requested-With
- Make sure logentries is utilized HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api.