I have a bunch of documents in Solr, where each document is a product. Each product can have a list of prices, like this:
{
"id": 1
"name": "Product 1",
"prices": [{"min":1,"max":100,"price":75}, {"min": 101, "max": 500, price: 50}]
}
Then problem is that this nested properties get stored in Solr like this:
{
"id": 1
"name": "Product1"
"prices.min": [1, 101]
"prices.max": [100, 500]
"prices.price": [75, 50]
}
The problem comes when I want to unserialize the json that Solr returns, because my objects don't have any "prices.min" field. So, is there any way for Solr to use the same format as it originally came in? I'm using rust and serde for talking to Solr:
#[derive(Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct SolrProduct {
id: u64,
name: String,
prices: HashSet<PriceRange>
}
#[derive(Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct PriceRange {
min: usize,
max: usize,
price: Option<Decimal>,
}