Query for Adding integer data in azure search - azure-cognitive-search

Is there any provision to receive the searched result fields data summed up as a single integer
For example, if I am searching for 'x' person's bank details and I want the amount he spent using his credit card then the result I need is the sum of all credit card transactions
I couldn't find any documentation.
If we cannot add then what is the best way to approach?
Thanks for your help.

Unfortunately, Azure Search doesn't do any such calculation on the response. However, you can easily implement that on the client side with the response from the service.
Nate

Related

Azure form-recognizer - prebuilt-invoice doesnt recognize currency, other custom fields

Azure form-recognizer, prebuilt-invoice doesnt recognize currency and some of my other custom fields from my invoice pdf. General Document gets me all key values. But for General document keyvalues I need to write algorithm to categorize the invoice related fields, which are already done in prebuilt-invoice.
I need all keyvalues from prebiult-invoice api, so I can find the missing elements by myself.
Anybody faced this? how do you overcome? one way I think of is, we can call both apis for same document. But it affects performance and increases cost.
any suggestion?

How to train multiple forms of the same query in R-n-R, instead uploading variation of the query & training it?

As I understand that in retrieve and rank we need to upload documents followed with questions for training purpose.
- So, like in Watson Conversation we have entities and synonyms that can be added as a dictionary. Do we have a similar feature in R-n-R wherein we can create a library of words for synonym, that can be mapped to a single value. say, savings account can be asked by user as savings acct, savings ac, savings a/c etc.
Right now this is being achieved by uploading variations of the same questions & ranked in task section.
how to open savings acct?, how to open savings ac?, how to open
Is there other ways of doing this, to make it more refined to capture all types of entities/variations asked by user?
You can create a list of synonyms while creating a collection. This will help retrieve and rank understand that these words are of same meaning. And, these synonyms can be created as groups.

How to list amazon orders through ASIN

Is there a way to get the orders only is you have an ASIN?
Right now what I am doing is to fetching all the orders through ListOrder (no ASIN returned here. but I can use AmazonOrderId) and then filtering/matching them out one by one through GetOrder (gives back the ASIN if you send AmazonOrderId). However this is an ugly way to do this as it takes a long process to filter out the desired Order.
I am wondering if anyone has a workaround for this? As I cannot to see any solution in the MWS docs.
You can request a _GET_ORDERS_DATA_ report. It lists all orders in a specified time period and contains ASINs for each order item. This means you can do it in just four requests (RequestReport, GetReportRequestList, GetReportList, GetReport, as outlined in "Managing Reports" in the Amazon Marketplace Web Service Developer Guide (Version 2009-01-01).
However you'll still have to do quite some filtering on that data to get only the orders that contain a certain ASIN.

How do you pre-compute a scoring system from the database?

Stackoverflow displays your reputation next to your username. I suppose it doesn't hit the database to calculate your score on every page render (or perhaps it does?). Would there be a total score field in the users table that gets updated when someone upvotes me?
What is the best practice for these kind of systems? I'm sorry if it's an obvious question, I'm new to databases.
When you log in, the number is pulled from the database along with all your users information.
It can be a user object. That user object has a property score which is initialized to whatever that number is in the database when you just log in.
As you go around the website and do stuff, the property is updated but not the database.
You can then update the database only once when the object user is destructed (either by logout or closing the browser) or after a certain amount of time.
I think the general answer for such a general question is: Caching! The idea of caching might be simple, but it's not always easy to do it right. I would assume that SO not only stores your total score. It stores all "events" which add to your score. Your total score is calculated out of these "events". So to the total score is already some kind of precalculated or cached value. If you don't want to hit the database for each request, you can cache the values in memory. Memcached is used often for such jobs, but there are other options of course.

Managing rank of records via apex in salesforce.com

I have a requirement I'd like to get some input on. I need to have an "account rank" field that will not include all accounts and I will need to be able to add to the pool, remove from the pool, and change rank. My problem is that each time I remove a record from the pool or move it to a new position, all records after (which could be as many as 10,000) will need to be shifted up or down. Salesforce has limits on individual updates of 200 at a time, or you can split it up into batches of up to a million. My concern with batches is I won't be able to guarantee that people won't update more than 5 records in a short time, therefore reaching past the salesforce limits on total # of batches allowed.
Has anyone dealt with these issues and do you have any suggestions for a best approach?
(I'd post this as a comment but I'm new and can't do that yet. Sorry).
I can't think of a good way to model this in the way you describe without resorting to some pretty custom apex using #future or batch, or having your own integration that does this recalculation through the salesforce API.
What determines account rank? Can you calculate it inside of a formula field?
This is a tough one... Can you re-think about this to somehting more SFDC-like? What if you were to generate the ranks on a dinamic way? You could for example create a voting system, or some grading system and have SFDC calculate the ranking for you.
Let's say you have one or more fields where you give a grade then have a SOQL query like this:
[SELECT ID FROM Account WHERE _ ORDER BY Vote1, Vote2, ]
If you change your Data Model it should make this quite easy e.g.
Create a ranking object Ranking__c and associate this with the Account object.
For each rank type or number create
a record with the details.
Associate the appropriate Account
records with the corresponding
Ranking__c record
When it's time to update an Accounts rank just change the Ranking__c records instead of the Account records. This should massively reduce the number of records you'd need to run over.

Resources