I'm aiming to store and index JSON key pair values. Ideally I would store them in a constant fieldname. (For simplicity sake, "GRADES")
An example of the incoming JSON object:
"Data": [{
"Key": "DP01",
"Value": "Excellent"
}, {
"Key": "DP02",
"Value": "Average"
}, {
"Key": "DP03",
"Value": "Negative"
}]
The JSON object would be serialized and stored as it is, but I would like to index it in a way to enable me to search within that same field by key and value. The main idea is to search multiple values within the same Lucene Field.
Any suggestions on how to structure the indexing? Lets imagine for example that I would like to search using following query:
[GRADES: "key:DP01 UNIQUEIDasDELIMITER value:Excellent"]
How would a customer analyzer/tokenizer achieve this ?
EDIT: An attempt to depict my goal more accurately.
Think of this typical relational type of structure (for simplicity sake).
Each document is a website.
A website can have multiple images (and other important metadata).
Each image has multiple sets of free keyvaluepair properties:
{ "Key": "Scenery", "Value": "Nature" }, { "Key": "Style", "Value": "Vintage" }
Another set:
{ "Key": "Scenery", "Value": "Industrial" }, { "Key": "Style", "Value": "Vintage" }
My challenge is come from a similar type of structure and index it in a way which enables me to build queries such as:
A website with an image of scenery:industrial and style:vintage.
I'm probably taking the wrong approach as indicated by Andy Pook. Any ideas how to efficiently flatten out these properties?