Breezejs iterates query with $top twice - breeze

Breeze v1.5.4 + webapi2
When I call my method,
IQueryable<InvestObjectInfo> InvestObjectInfos(....)
like this:
/DataApi/InvestObjectInfos?$orderby=TreeNode desc,Id&$top=20&treeNodeIds[]=1204&notChanged=false&isOrder=-1&searchString=
I always get 2 queries in sql trace, first w/o top and the second one with TOP specified.
What can be wrong here?

Actually, updating to 1.5.5 version has resolved the problem.
Thank you #SteveSchmitt

Related

Jira Rest API JQL query

I'm making use of the Jira API with the following call:
https://site.url/rest/api/2/search?jql=project=PROJECT&updated>=startOfWeek(-1w)
When I run this, I'm getting over 6000 results. But when I run the jql query of project = PROJECT AND updated >= startOfWeek(-1w) inside of my Jira sites search bar, I only get around 60 results.
Is there something I'm missing in my api call that would limit the returned to the data to the above query?
Edit
Looking further it appears my call is only bringing back results from my project space and not using the updated query. What should I do so it picks up both?
There is a typo in your query. You have used an ampersand instead of the word 'and'. The ampersand is the character used to add query parameters, so you effectively did this query
https://site.url/rest/api/2/search?jql=project=PROJECT
then Jira just ignored what came after the ampersand, as it didn't know what the parameter 'updated>' was, or how to make it equal 'startOfWeek(-1)'
Within the JQL, you must use the word 'and' with spaces before and after, like this:
https://site.url/rest/api/2/search?jql=project=PROJECT and updated>=startOfWeek(-1w)
Only use ampersands to add other query parameters afterwards, like this:
https://site.url/rest/api/2/search?jql=project=PROJECT and updated>=startOfWeek(-1w)&startAt=0&maxResults=500
Please send the API as POST method:
API: https://url/rest/api/2/search
Body:
{
"jql": "project='project name'&updated>=startOfWeek(-1)"
}

Getting Distinct or FirstOrDefault with Breeze Client-Side

A query already executed with breeze on the client side and I store the results locally. I was really hoping to either .Distinct() or .FirstOrDefault() on the client side so that I can execute locally instead of going back to the server.
I know that breeze has limited capabilities on the client side. I've looked through the samples and no luck there.
http://www.breezejs.com/documentation/query-examples
Can breeze do this? Is this something that they will be doing in the future?
There's nothing yet built into breeze that will do this. I've run into the same thing, and had to call .Distinct() and .FirstOrDefault() on the server side. There is an outstanding suggestion from last year in the breeze forums (currently at #10 on the list by vote count) to add .Distinct()-like functionality.
I need to see your query to answer properly.
In almost all cases, take(1) is equivalent to firstOrDefault and works fine on both remote and local queries.
var query = breeze.EntityQuery.from('Persons')
.where('FirstName', 'eq', 'Lizzy')
.take(1); // will return one or null
If you want to find an entity by its key, looking first in the cache and then going remote if necessary, then you should consider the fetchEntityByKey method.
Distinct only makes sense for projection queries in which the objects returned (which are NOT entities, btw) have no id. Can't know if that is what you need until you show me your query.
With due respect, I feel that hunch_hunch's answer is a bit misleading. Please reconsider checking MY ANSWER as the best answer.

Neo4jClient: Does it support timeout parameter for executing queries?

I am using neo4j 1.9.4 community and soon will upgrade to 2.x. I know that neo4j can be configured with timeout in 2 ways as described here
But I wanna know if the second approach i.e. including max-execution-timeout in REST call header is supported by any of the Neo4jClient method so that I can pass that value as a parameter before returning my results? Also, will it be supported by future neo4j release?
The goal is to define a timeout for each query rather global setting.
Something like :
GraphClient
.Root
.StartCypher("root")
.Match("root-[:HAS]->childs")
.Return("childs")
.Results(5000) // passing timeout value in ms
At present, no, Neo4jClient doesn't have this capability.
Will it be supported? That depends on a few things, but as it's open source (https://github.com/Readify/Neo4jClient) you can always add it yourself and get it into the next release.
PS. For using against a 2.x db, you will want to look at the .Cypher so your query will look more like:
GraphClient.Cypher
.Match("root-[:HAS]->child")
.Return(child => child.As<ChildObj>())
.Results();

SphinxQL builder get total_found

I am using SphinxQL build with zend db style queries sphinx, it works great.
https://github.com/FoolCode/SphinxQL-Query-Builder
I am trying to figure out how to get total_found number from the query.
I try SphinxQL::create($this->conn)->query('SHOW META'), but it seems the return array doesn't have total_found column.
Or I have to run another query to count the result.
thanks
Ok, I just try it and works, I missed the ->execute() part, so it works well now.

How can I retrieve an entity by key without using filter with JayData

JayData has a method on EntitySet called find(keyValue, cb). However, this method translates to the following OData query:
http://localhost/api/MyEntitySet?$filter=(Id eq 1)&$top=2
Why doesn't the OData provider query by key instead? Like so:
http://localhost/api/MyEntitySet(1)
I find the second query to be more natural in this case, also easier to debug. Is there a way to force JayData to use the second query?
Sorry, we don't support this now. You can add it to our backlog (http://jaydata.org/backlogs) or open an issue on github.
Now it seems to be supported, but not documented yet. I have tested wit the Version 1.3.6. The reuest was translated into
http://localhost/api/MyEntitySet(1)
The only documentation i found was here (Search for "New find() for OData provider"):
http://jaydata.org/blog/release-notes

Resources