I'm using Worklight6.2 and I have a small problem related with JSONStores.
I have several on my application to aid me relating to my relational model on a third party database. To properly work with this paradigm I'm trying to use several search indexes to find documents inside my store. Let's say I have a store with this aspect
var data = {GUID: 'XPTO-XPTZ-FOO', product_name= 'potatos'}
Sometimes I want to access my object by GUID some other times I want to access it by product_name. So I would have a
var searchField = {GUID: 'string'};
var additionalSearchField = {product_name: 'string'};
Thing is, when I use this additionalSearchField it doesn't find my potatos. I would like to use additionalSearchField to avoid JSONStore recreations.
I think that I'm not using additional Search Fields the way they were intended, but I'm having trouble wrapping my head about its concept.
From IBM Documentation:
Additional search fields are keys that are indexed but that are not part of the JSON data that is stored. These fields define the key whose values (in a given JSON collection) are indexed and can be used to search more quickly.
Can someone help me understand how they work?
You should use the product_name as part of the initialization of that collection, so you will have two search fields UID and product_name, i.e.:
Then you can go ahead and do the searching, i.e.:
You could also do the same for the product_name