Closed MariamN closed 10 years ago
The part of product filtering after user selects/deselects a particular attribute is complete. The filtered set of product after the user specifies its attributes is in variable in productsToDisplay. The code has been inserted in the sendCurrentFeatureList() function in the SearchController class. I couldn't figure out how to update the product set display. I pushed the code to the master branch now.
Thanks Nishanth. I will check it out.
I committed the code for updating the display of the product list.. @nishanth1991 I keep getting an empty list from the updated products. The variable productsToDisplay is always empty. Here is my testing query: 1- search iPhone, 2- select Smart Phone equivalence class. 3- From Specifications i choose Sprint as the Carrier used. This should reorder the list of products and make sprint iPhones appear first. Instead I get an empty list.
Hello Mariam, I checked through the code. When I wrote the code you were passing me specifications whose values were changed. userScoredFeaturesSpecs had a list of ScoredAttribute which had their values changed by the user. FilterandReturn function would return a set of Products whose specifications match as per the user requirement. If the user had exclusively ticked Sprint, the function would return all the Product matches of Carrier used as Sprint. The rest of the products which had a different Carrier would be omitted by the function rather than rank them lowly. I guess in the modified code you are changing the mean value of it, but since the filter function looks for exact matches, none of the products could match all the mean values and hence returning an empty set. I guess its a decision decision now, on how the products should be displayed. @enewe101 , if a user exclusively ticks a particular attribute, should we show only the products matching that attribute, or to rank them higher ? Some Categories return products in numbers of 100 + , Displaying all 100 products everytime might not be a good option.
For now I reverted the code to pass you only specs who's values changed by the user. But I think we should return from the FilterandReturn function multiple sets of products grouped by their relevance to the user's selected features. Something like the example we saw in one of the class presented papers. So, one group would be only the products matching the Sprint Carrier, Second group may be products that have High resolution camera but are not Sprint carrier. (assuming the user selected high res cameras as preferred feature).
That could be something to consider for future milestones.
There are two test failures in Issue31 that get merge into the attribue_merge2 branch (sry for the typo).
Line 123 of the TestFiltering.
assertEquals(60, productsToDisplay.size());
What is the 60 for? It fails there.
This may be linked to the change to TypedValue. The test relies on two categories in the data base, and I believe the 60 is hard coded.
I can't say if there is an error in the TypedValue since my tests pass and the if I look at the code that is tested by failing test there is an error in the code that may not have been caught by the test before the change to TypedValue:
In RankedFeaturedProducts, line 49
if((b.getAttributeMean().toString()).equals("NA")||(b.getAttributeMean().toString()).equals("Data not available"))
This line is comparing to the toString() value of the AttributeValue instead of the actual value. I didn't implement a to String for the TypedValue, so I believe that is where it fails. I will implement a toString() for tonight but I will create an issue for this.
This solved the issue with the tests.
update product ranking based on user's selected features