I'm bit confused with Algolia settings releated to sorting, specifically in the dashboard I created new replicas, products_price_asc & products_price_desc. Then I come to the ranking formula and added a "price" attribute to the sorting.
However, it allows me to pick up the price attribute only once, so as to specify the sorting order of the price.
So the result is, that I have a dropdown menu with 2 options (price order ASC and DESC), but only one of them works correctly.
It's my first day with Algolia, so maybe I've missed something, but if anyone can explain me, how to implement this, I'll be happy.
Thanks in advance.
Creating replicas for sorting is the right first step: you need one replica per sorting order (in your case, one for sorting by price DESC, and one for sorting by price ASC).
But you need to update the Ranking Formula on the replicas themselves, not on the main index.
So, on products_asc, you should set this:
And on products_desc, you should set this:
Now, when you need to order results by ascending price, you should target the products_asc index for your search. When ordering by price descending, it will be products_desc.
Related
I'm a newbie when it comes to Google Doc Filters and I would appreciate some help.
I got a list with articles where I would like to filter by company (in this case SONY), but also filtering by lowest price combined with lowest shipping costs.
Example: the first filter I created, creates a list with SONY articles.
=(filter(A2:D12;A2:A12="SONY"))
Now I would like the filter to give out a single row, where the price and the shipping costs are the lowest, in this case, the product is:
SONY headphones with the price of 20 and shipping costs of 2,99
Im basically trying to combine the filters:
=(filter(A2:D12;A2:A12="SONY"))
=SMALL((C2:C12);2)
=SMALL((D2:D12);2)
in one single, long filter
Thank you
SEE SCREENSHOT HERE
Solution:
FILTER would not work in your case because you have a priority column to be filtered, in this case, column A before C and D.
You may use QUERY instead:
=QUERY(A2:D12,"select * where A='A' order by C+D limit 1")
This would select the entry with a specified value in column A (company), then order by the sum of C and D (price+shipping) in ascending order, and then output the first row, which is the minimum.
Sample Sheet:
References:
QUERY function
QUERY language
How do I return different values (Y or N) to different cells (ColD - Master) based upon matching criteria (ColA - Date and ColB - Customer) and sort orders (MasterItemRanking tab ColA) in Google Sheets?
https://docs.google.com/spreadsheets/d/1Yar31N__3jkHH3y6qn_XZ0cvkEg-gG0ALeT0FF8qEQE/edit?usp=sharing
On Sheet "MasterItemRanking" ColA, the lower the value in ColA, the higher the ranking. Ranking of a #1 is superior to a ranking of a #2 or #5, etc (which means ColB item should be returned as "Y" before any of the others).
I have tried various expressions in ColD and have failed miserably so far. Thoughts? Thanks.
This is a complicated answer, but it seems like this formula works. =arrayformula(if(A2="",,iferror(if(C2=vlookup(MIN(if(countA(vlookup(filter(C$2:C$10,A$2:A$10=A2,B$2:B$10=B2),{MasterItemRanking!B:B,MasterItemRanking!A:A},2,false))=1,"N",vlookup(filter(C$2:C$10,A$2:A$10=A2,B$2:B$10=B2),{MasterItemRanking!B:B,MasterItemRanking!A:A},2,false))),MasterItemRanking!A:B,2,false),"Y","N"),"N")))
I put it into your sheet and it seems to make sense, although if there is anything it is missing, let me know. It basically filters the table for just that row's data to see if there are multiple items that have the same date and person. Then it does a vlookup to return for each item its ranking. Then it grabs the min value ranking and checks that value against the item in that row. For example, if it returns ranking one, then it checks that row item to see if it is also ranking #1. It does this for each row. This is a very convoluted answer lol, it is sort of hard to explain this one.
I have a products index that displays filtered results on category pages.
For a given category, any amount of products may be flagged as featured, meaning it displays first.
When products are displayed for a category, only one featured product should show at a time (at random from the available products flagged as featured)
Additionally, a product should not be flagged as featured if it has date range fields and the current date is not within the range
So, my index might look something like: https://gist.github.com/1a0327d8a321dc6627e197b94f4209c9
A solution to 1. has been posted here: https://stackoverflow.com/a/40922535 using optional filters, currently in private beta: https://www.algolia.com/doc/advanced/optional-filters-scoring/. At query time I could do optionalFacetFilters: ["featuredIn.category:category1"] Update: I've since been told by Algolia reps that this feature is has a large performance cost, and therefor is only really viable for enterprise customers.
However, I'm at a loss as to how to pull of 2. and 3..
Any guidance is greatly appreciated!
I need help.
I am new to obiee (recently moved from business objects and re-creating all reports in obiee).
Here is an example I need help with. I have created an analysis where I am listing all orders with their target delivery dates and number of products in each order.
Order Id......Target Delivery Date...No of products
Abc....1/1/2016.....5
I want to add to a column next to No of products called "No of prods delivered on time". I want to compare delivery date of each product within a order with the target delivery date and
Give count of products delivered within the target date.. So the output should be
Abc....1/1/2016....5.....3
Where 3 is number of products delivered on time.
I could do it in BO by running two queries and merging them however in obiee I am not able to add second query to my analysis. I did try at product level using case when target date >=delivery date then 1 else 0 and wrapped this with sum function to aggregate but it didn't work ..
Appreciate your help in this. Searching for this topics give me results for running queries from multiple subject area :(
You also have unions in OBIEE, you union the results of 2 queries which return the same structure, so you have query A with Order ID, Target Date, No Products and a Dummy column with a 0 and default agregation Sum, and a second query with Order ID, Target Date, Dummy column summing 0 and the number of products delivered.
You do all this in the criteria tab of the analysis. It's important the order in which you put your columns, because that's what OBIEE is using to do the union.
Regards
Consider I have two collections in MongoDB. One for products with documents like:
{'_id': ObjectId('lalala'), 'title': 'Yellow banana'}
And another stores price changes with documents like:
{'product': DBRef('products', ObjectId('lalala')),
'since': datetime(2011, 4, 5),
'new_price': 150 }
One product may have many price changes. The price lasts until a new change with later time stamp. I guess you've caught idea.
Say, I have 100 products. I want to query my DB to get know what's the price of each product at the moment of June 9, 2011. What is the most efficient (quick) way to perform this query in MongoDB? Suppose I have no cache solution or cache is empty.
I thought about group statement on prices collection, where reduce function would select last since before a date provided, grouping by product.$id. But in this case I would not benefit from an index on since field and all documents would be scanned.
Any ideas?
I had a similar problem, but for GPS locations. I found the fastest way was to set up a query for each item, which is rather counter-intuitive if your used to SQL databases.
Query for the item where it's timestamp is less or equal than the date your looking for, and limit the result to 1. Repeat for each item. To really speed things up, run multiple querys in parallel to utilise all the cores on the MongoDB server.