Ask17
Ask17

Reputation: 82

Do we need to create schemas in the latest Apache Solr? If yes, then how do I make a schema for a Product with attributes?

I have an e-commerce store and the table structure of that is as follows:

Products

product_id  | name          price
1             galaxy s9 red     800
2         galaxy s9 blue    850
3                 t-shirt               30

Product Variants

procut_variant_id   product_id  variant_name        
1           1       red
2           1       128gb
3           2       blue
4           2       128gb
5                       3               xl

I'm submitting the documents through solarium php and this is the format which I've got: We've got more than 1200 product variants. How do I make a schema for this kind of Data?

Is this okay? FYI:I have no prior experience in Apache Solr.

  "responseHeader":{
    "status":0,
    "QTime":27,
    "params":{
      "q":"*:*",
      "_":"1550306389227"}},
  "response":{"numFound":3,"start":0,"docs":[
      {
        "id":"1",
        "name":[" galaxy s9 red"],
        "price":[800],
        "memory":["128GB"],
        "color":["red"],
        "_version_":1625614359718789120},
      {
        "id":"2",
        "name":["galaxy s9 blue"],
        "price":[850],
        "memory":["128GB"],
        "color":["blue"],
        "_version_":1625614359913824256},
      {
        "id":"3",
        "name":["t-shirt"],
        "price":[30],
        "Size":["xl"],
        "_version_":1625614360041750528}]
  }}




Upvotes: 0

Views: 47

Answers (1)

Abhijit Bashetti
Abhijit Bashetti

Reputation: 8668

Your schema looks ok to me. Only thing I notices is that all your fields are multivalued=true. I don't think you need it. You have already merged the 2 tables in single solr document.

Mark the fields as indexed=true in the schema.xml which are been used in the search.

Upvotes: 0

Related Questions