Using custom metadata in the result of OData queries - odata

I wonder if it's possible to use custom metadata within the result of OData queries (at the entity level). I think of metadata such as scores since the query executed on an ElasticSearch database and I would like to provide these hints to the end user.
Thanks very much for your help!
Thierry

Sorry I'm not familiar with ElasticSearch. But if I understand your questions correctly, you want some information other than the raw data in the request result ? If so, there is such things called Instance Annotation that may satisfy your need. An explanation from OData spec.
HTH

Related

Jira - create rest api query

I'm using the Jira API with the following call: https://site.url/rest/api/2/search?jql=project=PROJECT&orderBy=Resolveddesc, however, it's not showing as per applied order by resolved desc.
No static URL like - https://site.url/rest/api/2/search?%20Requests%22%20%20ORDER%20BY%20RESOLVED%20DESC
Also, I am looking to filter the following fields in RestAPI to improve the performance.
fields": ["summary","assignee","status"]
any help on this would be appreciated.
Without sample data, it is hard to know if you data support those filtering.
Below should be what you want.
https://site.url/rest/api/2/search?jql=project=PROJECT+order+by+resolved+desc&fields=summary,assignee,status

Query tags/context labels of senses using JWKTL

I am working on a project where I need to deal with Wiktionary. For some entries, there are context labels/tags before its sense I want to query for, e.g. idiomatic, transitive like HERE. I am now trying to use JWKTL, to do the job. But it seems no api call supports the query.
Can anyone let me know how to get that information by JWKTL, or, is there any other tool can parse the Wiktionary dump .xml file while being able to access that labels/tags?
Thanks.
According to Dr. Christian. Meyer, there is currently no API on this.
I ended up with pattern matching in the original wiktionary .xml dump.

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.

Using Lucene.Net_2_9_1/contrib/Spatial.Net with Umbraco

I've tried doing this with Umbraco 6.1.6. I've pretty much implemented what Drew did here: http://our.umbraco.org/forum/developers/extending-umbraco/23200-Lucene-with-spatialnet?p=0
I'm storing lat and long data in umbraco nodes. The nodes are being indexed as encided values with tiers. But, I am not returning any results when I add the DistanceFilter to the query.
I'm just wondering if anyone else has tried this and got it working. Perhaps you can post some code.
Thanks.
Josh,
Have you inspected the index using luke just to ensure that fields are there? Also have you tried running raw queries (get the generated query written out using code) on the index using luke?
Regards
Ismail

Ruby on Rails: How to have multiple controllers for one table AND multiple models

I'm new to Ruby and to Rails. I have played a bit with Sinatra but I think that Rails is a more complete framework for my project. However, I am running into trouble with this.
I am working with an fairly substantial existing, and heavily used, mySQL database and I am trying to build an API for this that will report on certain features. The features that are needed are, for the most part, counts of records by certain groupings, then drilling down into details.
For example we have a table - tableA, that contains lots of information relating to documentation. One piece of information we want to report on from that is the number of items in a given language. The language code is stored against each item and based on a get request I would like to return JSON.
Request: /languages/:code/count/:tablename
There are two variables in that most specific URL - the code we are counting and the table we are counting from.
I understand that in routes.rb I can set up a mapping:
get '/languages/:code/count/:table', :controller=>'languages', :action=>'count'
I have a controller - languages_controller.rb with a count method in it. this then matches to a corresponding view file count.html.erb
In all the tutorials I have read and examples I have followed the main point seems that 'languages' would be a table in the database and would therefore be available under the 'magic' Rails approach.
My issue is that it is not a table, rather the results of the call should be a limited subset of the fields in tableA. Such as languagecode and count(id).
The description of the language needs to be looked up 'manually' as it is stored as an internal code that is not in a database anywhere (historic decision/madness).
The questions:
how do I have a model that is only a subset of fields, plus some that are manually populated - languagecode, isocode, description, count
Am I right in thinking that once I have the model defined as such as I could use ActiveRecord to get data from the database and then in the controller add the extra information in?
Can I change table in the model based on the parameter sent in the URL?
Essentially, I am at a loss at the moment on what to do with this. I have the routes defined, the view templates in place and the controller there and ready to go. The database component - getting some data from a pre-existing table seems mysterious to me.
Any help is greatly appreciated, it seems that the framework is currently getting in my way and I know that I can't be the only one trying this sort of thing so if you have any advice please share.
There's really no need for a model here, at all. This isn't what ORMs are for. What you should be doing is just running raw SQL against the database, and iterating over the results. Consider doing something like this: https://stackoverflow.com/a/14840547/229044

Resources