Suppose we want to build an e-commerce website that includes different products and for example these products are divided into four or five categories. Each category of products has its own fields and of course there are a series of common fields among them such as product name, price, description and ...
My question is, should we define four or five different schemas for each kind of product?
I do believe you should create one schema for each category of products, even though they may share some similar fields.
You can create one object for the similar fields and insert them into the Schema if it helps to not have to repeat yourself.
If one Schema have all the fields that all the products need, it would be too bloated. And it won't make sense to have different Models for each category too. When you query for a product, it will return many fields which do not relate to the product.
Related
I'm using Azure Search on my e-commerce site, and now want to implement filtering.
I've faced issue with performance. I have index with products. Each product belong to category. Each category can have nested subcategories.
My business purpose is when customer is on category page i need to show products even from subcategories, so i have doubts about how to store this relation(products to categories) in azure products index.
I'm considering two possibilities:
I can store only products category id in field with type Edm.Int32. Then when customer goes to this category i query to my sql server to get all subcategory ids and then construct my query to index like this
categoryId eq 34 or categoryId eq 36 or categoryId eq 37 ...
Other way is to create field with type Collection(Edm.String) and to store products category id and nested categories ids in this field and then my query to index would look like this
categoryIds/any(c: c eq '35')
So which way will be faster?
Option #2 is likely faster since the number of documents in the index will be far fewer, but the only way to be sure is to run some experiments with your data and queries. Overall query performance is going to depend on other factors like whether you're doing full-text search, faceting, geo-spatial, etc.
I am trying to design a view with multiple categories, and each document can belong to multiple categories at the same time.
For example, File A is in category:
1->a;
2
I can achieve this effect by specifying the columns as categories and access the document through various routes. However, I fail to specify which category the sub-categories belong to. This is what I am getting instead:
1->a;
2->a
The case doesn't seem too big of a difference but basically the view is returning every combination of the categories and the amount of entries can get very large.
I have tried to add the super category in front of the sub-category and try to filter out entries which the categories do not match the prefix of the sub-categories(e.g. 1,a), but I cannot find a way filter them out. Although the multiple values are shown in different entries, when I try to use the variable it extracts all the values.
Is there a way I can filter the entries based on that particular row instead of all the values? Or is there anyway I can achieve the effect through other methods? Thank you in advance.
You need to collapse Categories and subcategories into a single field. The Domino way to do this is to separate category and subcategory by backslash. So your category field would be something like:
"1\a":"2"
That ties the subcategory to the category. Or if you want to be able to find a document by subcategory only:
"1\a":"a":"2"
You then can use a little formula magic to get from the subcategory back to the main category (presuming the subcategories don't duplicate):
AllCategories := "1\a":"a":"2";
foundCategory := "a";
#Trim(#Replace(AllCategories;foundCategory:#Trim(#ReplaceSubstring(allCategories;foundCategory)));
This would return "1\a" (Note: the formula above is written is classic #Formula language, it is left as an exercise to the reader to translate that to the JavaScript formula equivalent)
Hope that helps
I'm going to try and make this as least confusing as possible, I apologize in advance if my attempt is a failure.
I work in education and am trying to create a predictive analysis document that will tell us how many class sections we will need to offer in a given semester.
I pulled data from the past five years and consolidated it into a pivot chart. I set the pivot chart to combine all courses with a common Subject, Course Title and Catalog Number (See image below for more detail), and output 3 different columns of values based on what we need.
The problem I am facing now is with curriculum changes throughout the years. There are some courses within the list that are no longer being offered and a new course with a new Course Title, Subject and Catalog Number that can now be substituted for the previously needed course. Since the data has been pulled into one pivot chart, both the old curriculum courses and the new curriculum courses are in one list.
I would like to somehow create a relationship between the old curriculum courses and the new curriculum courses. If possible I would like the names of the courses to remain separate, but the values of the old and new to be averaged out together in their respective rows.
In a new page, I plan on putting an easy to use form where the user can select a course subject and name, enter in some other necessary data and the document will output the amount of course sections needed.
Does anyone know of a way to make a relationship between two cells and have other cells effected by this relationship?
Thanks so much!
Mike
enter image description here
Suppose I have have a huge list of movies categorized by genres. Users can vote for movies, and each movie can be in multiple genres.
What is a good way to store this in Cassandra if I want to present the top X movies per category? Please ignore other use cases as I can have other column families as required (like presenting detailed movie information).
Action
Movie A
Movie B
Movie C
Comedy
Movie D
Movie E
Movie A
Based on the information you have presented -I say that you only gave requirements to create a single column family.
The columns would be - movie name, category, and any other attributes about the movie.
It is quite common to create several column families with different structure that are like 'materialized views' of original column family.
In Cassandra you design column families based on how the application is going to use it. So, you design your queries first then you design the column family to support it.
Is ExpressionEngine capable of handling HABTM (has and belongs to many) relationships, even if it's with a plugin?
Basically, I have two channels: recipes and ingredients. A user needs to be able to create a recipe by assigning entries from my Ingredients channel, but when adding an ingredient they also need to specify additional data such as quantity. Is this possible?
Your answer lies in two indispensable EE add-ons by Pixel and Tonic: Playa and Matrix.
Playa is a many-to-many relationship fieldtype and module.
Matrix is a fieldtype which allows a single field to contain multiple rows of multiple predefined columns of data, each column of which can be a different fieldtype (including Playa).
So in your case, you'd have your standard Ingredients channel, then in your Recipes channel, you'd have an Ingredients field, which would be a Matrix fieldtype. In your Matrix field, you'd have one Playa column which displayed a dropdown of entries from your Ingredients channel, and another column that was a simple text input set to Integer for the quantity.