I am trying to retrieve Min, Max and Average on CloudSearch Column (index) in search result. I can not do it in code since I am only fetching 1000 records and Aggregation is required on all data searched by query.
I tried with Min expression but it returns for each record.
Any idea what query or Configuration I would required?
I implemented this by calculating on .net side.
Related
I'm using cosmosdb with azure table api and no where can I see any way to get total records count from a table. Can see that there are ways to get count of records with sql api. What is the best possible way to get count using azure table apis? I'm using nodejs to connect to this instance.
What is the best possible way to get count using azure table apis?
Based on my researching and rest api, unfortunately, there is no directly way to get count using azure table api which is similar to count keyword in sql api query.
One way to do so would be to list all entities in a table and get their count. This is an utterly horrid approach and can be a bit costly if you have to iterate through billions of records. Best you can do is do a projected query to enumerate through all the Partition & Row keys and sum them up thus controlling the cost and time of the operation.
In addition,you could send your desired requirement in cosmos db feedback.
I found this page: https://microsoft.github.io/AzureTipsAndTricks/blog/tip152.html
I tried to do the same in nodejs and it worked for me:
await container.items.query('SELECT VALUE COUNT(1) FROM c', {maxItemCount: -1}).fetchAll();
I am developing an application (Python 3.x) in which I need to collect the first 13,000 results of a CSE query using one search keyword (from result index 1 to 13,000). For a free version of CSE JSON API (I have tried it), I can only get the first 10 results per query or 100 results per day (by repeating the same query while incrementing the index) otherwise it gives an error (HttpError 400.....returned Invalid Value) when the result index exceeds 100. Is there any option (paid/free) that I can deploy to achieve the objective?
Custom Search JSON API is limited to a max depth of 100 results per query, so you'll need to find a different API or devise some solution to modify the query to divide up the result set into smaller parts
I have been trying some queries using the COUNT aggregate in DocumentDB that was just recently released. Even when I run the exact same query multiple times, I am regularly getting different results. I know my data isn't changing. Is there a bug with the aggregate functions, could I be reaching my RU limit and it is only returning the counts that fit within my RU amount, or is something else going on?
My query looks like:
Select COUNT(c.id) FROM c WHERE Array_Contains(c.Property, "SomethingIAmSearchingFor")
My collection contains about 12k documents that are very small (3 or 4 string properties each and one array with less than 10 string items in it)
In DocumentDB, aggregate functions are distributed across 1-N partitions, and within each partition executed in chunks/pages based on the available RU like guessed. The SDK fetches the partial aggregates and returns the final results (e.g. sums over the counts from each result).
If you run the query to completion, you will always get the same aggregate result even if the individual partial executions return different results.
In the portal use the "Load more →" link to get the count of the next portion. You need to manually record the counts shown so far and sum them to get the final aggregated count.
I have an index that is populated with Products. Each product has price field. I want to implement facet navigation on categories pages and i want my users to be able to search for products within a price range. At the same time, I want them to know what the minimum and maximum product price is across products in selected category. As i know Azure Search does not support min/max values in responses. So i am looking for some work around. I think that i can mark my price field as facetable and get min and max value from facet result, but default facet results count is 10, and if i understand correctly to get all prices from facet result i need to set count to Int.Max or something. That does not sound nice.
So what is the best solution to get min and max product price in specific category?
More direct approach to get the min and max product prices would be using $filter, $orderBy and $top in a Search request.
For example,
https://[service name].search.windows.net/indexes/products/docs?search=*&$filter=productName eq 'Toys'&$orderBy=price asc&$top=1.
You will need to parse the price in the response.
The approach using facet would be more expensive and, as you said, can only get you an approximation because boundaries of each facet is from pre-configured range.
Nate
My goal is to round score to group similar items and then sort by another field (let's use price as an example).
I'm able to accomplish this with the following query:
/select?defType=func&q=rint(product(query({!v=the search term}),100))&fl=score,price&sort=score%20desc,price
However, this query returns every document indexed in Solr.
How can I filter this query so that items with a score of 0 are excluded?
I've tried adding {!frange l=1} to the query which kind of worked... but it made all of the scores equal to 1. This obviously isn't good because I need to show the most relevant results first.
Thanks in advance for any help.
Alex
I spent hours trying to filter out values with a relevance score of 0. I couldn't find any straight forward way to do this. I ended up accomplishing this with a workaround that assigns the query function to a local param. I call this local param in both the query ("q=") and the filter query ("fq=").
Example
Let's say you have a query like:
q={!func}sum(*your arguments*)
First, make the function component its own parameter:
q={!func}$localParam
&localParam={!func}sum(*your arguments*)
Now to only return results with scores between 1 and 10 simply add a filter query on that localParam:
q={!func}$localParam
&localParam={!func}sum(*your arguments*)
&fq={!frange l=1 u=10 inclusive=true}$localParam