Defining facets on a date range - thinking-sphinx

I want to define a facet on a date range.Is this possible?
For example I have many requests and I want to have a facet displaying
something like this:
Requests today(2)
Requests this week(10)
Requests this month(245)
where 2,10 and 245 are the number of requests raised on this day,this
week and this month respectively.
Thanks in advance.

Please refer to:
http://groups.google.com/group/thinking-sphinx/browse_thread/thread/e7a8f18f8e064d5c

Related

Unable to retrieve unlimited number of record via API

We are struggling to mine all time records for this year via API.
We have tried to include the :dont_limit_result GET variable and set it to 1, however it did not help us.
The version that we use is ACTIVE COLLAB 5.11.0, the URL we are hitting: projects?dont_limit_result=1&page=$page
Please give me some advise on how to proceed.
Most of API responses are paginated, and pagination can't be turned off using a GET switch. Instead, you should check following headers:
X-Angie-PaginationCurrentPage - indicates current page
X-Angie-PaginationItemsPerPage - indicates number of items per page
X-Angie-PaginationTotalItems - indicates number of items in the entire data set.
and walk through pages until you reach the end of data set.
Another option is to give project's filter a try. Here's an example request that will return all projects:
curl -H "X-Angie-AuthApiToken: YOUR-API-TOKEN" "http://your.activecollab.com/api/v1/reports/run?type=ProjectsFilter"
This one will return all active projects:
curl -H "X-Angie-AuthApiToken: YOUR-API-TOKEN" "http://your.activecollab.com/api/v1/reports/run?type=ProjectsFilter&completed_on_filter=is_not_set"
I'm using the php API wrapper 3.0 - how do i get the headers back to know there are more pages and then what is the correct form of the query to get further pages?
For example my basic query is:
$timeRecords = $client->get('projects/22/time-records')->getJson();
to get time records - but this only returns 100 and there are more!
Thanks,
P

How to retrieve more than a month of stock quotes using Yahoo finance api?

Basically I'm new to using Yahoo finance Api. I've tried YQL Console but I can seem to find what I needed. I have to get like 3 months worth of stock quoute data. I found this http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=30d/json
This is exactly the sets of data that I needed but it only gives me a whole month of data. No matter how I change the range=30d to say range=90d it gives me the same result.
Sorry cant comment due to my low reputation.
what you need to do exactly is use the following arguments in the url
30days: 30d
90days/ 3months: 3m
180days/ 6 months: 6m
365days/1 year: 1y
so the link for 3 months will be
http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=3m/json
Hope it helps. :)

NelmioApiDoc Bad Request 400 with RestApi

The Nelmio is working perfectly in my project but I get an error 400 Bad Request
when I want to insert a date in my Nelmio !!
The type used is Date.
you send something like
transaction[dateP]=value
but form required something like this
transaction[dateP][year]=value&transaction[dateP][month]=value&transaction[dateP][data]=value
So split your value into 3 parameters or you can change widget option of dateP field to single_text to solve the problem.
I guess that all the transaction details are not needed as parameters which have to be defined in the URL of you request.
In case of being data, you will have to specify it like this {"transaction":{}} in the content box on you right.

Valid to return different json-response depending on list or retrieve?

I am currently designing a Rest API and is a little stuck on performance matters for 2 of the use cases in the system:
List all campaigns (api/campaigns) - needs to return campaign data needed for listing and paging campaigns. Maybe return up to 1000 records and would take ages to retreive and return detailed data. The needed data can be returned in a single DB call.
Retrieve campaign item (api/campaigns/id) - need to return all data about the campaign and may take up to a second to run. Multiple DB calls is needed to get all campaign data for a single campaign.
My question is: Is it valid to return different json-responses to those 2 calls (if well documented) even if it regards the same resource? I am thinking that the list response is a sub set of the retreive-response. The reason for this is to make to save DB calls and bandwitdh + parsing.
Thanks in advance!
I think it's both fine and expected for /campaigns and /campaigns/{id} to return different information. I would suggest using query parameters to limit the amount of information you need to return. For instance, only return a URI to each player unless you see a ?expand=players query parameter, in which case you return detailed player information.

google json api search results limit, not 100 search queries per day

The Google Custom Search API requires the use of an API key, I have get from the Google APIs console. The API provides 100 search queries per day for free. I want to more,so I have signed up for billing in the console and succeed.I can set the requests/day,defalut 1000 requests/day.But the total results are still 100,I show 10 in one page,so I can get 10 pages.
Billing solve the querys per day,but not the total results.The document does not explain clearly.What should i do to solve the results problem.Does XML API have the same problem? Must I Replace the JSON API by XML API?
another year passed... Limits are the same =((
Google forces us to use multiple accounts to get complete search results.
Use a query per day/week/month.
Or you can sort huge result array by publish date. And when '100-items' limit is reached you should execute new request with excluding first items by applying "the lowest(or the highest) possible value" condition on publish date.
btw, using webbrowser you could set 100 results per page. So total count of result items is 1000 per query. Web crawling would be helpful=))))
be happy!