Query is not returning any value when I am filtered by dropdown value | Community
Skip to main content
Abhishekty
Level 4
September 24, 2021
Solved

Query is not returning any value when I am filtered by dropdown value

  • September 24, 2021
  • 1 reply
  • 1875 views

I have written a query for that I have also define the index  and it is executing correctly but not getting results.

my thought is, property which I am filtering that is set by in aem commerce a dropdown that why it is not able to match but if am filtering a property which set simple text then I am getting results.

 

for example :

my object look like below:

 

{
"data": [
[{
"datatype": "DeviceDataUse",
"values": {
"defaultskuid": "141200172",

"identifier": "dvc12080008prd",
"storageunit": "GB",
"availabilitystatus": "Sellable",
"tinynoborder": "xx",
"skuimages": ["xx"]
}
}, {
"datatype": "DeviceSkuDataUse",
"values": {
"halfsize": "xx",
"identifier": "128000055",
"image": ["xx"],
"hexcode": "#1F2120",
"derivedinventorystatus": "BackOrder",
"availabilitystatus": "Supported",
"fullsizeborderlesspng": "xx"
},
"pageUrl": "xx"
}]
]
}

 

SELECT * FROM [nt:unstructured] AS s WHERE (ISDESCENDANTNODE(s, [/etc/commerce/products/myProject/en/devices])) and s.derivedInventoryStatus = 'BackOrder'

 

for "identifier" it is working fine.

 

// queryString = "SELECT * FROM [nt:unstructured] AS s WHERE (ISDESCENDANTNODE(s, [/etc/commerce/products/myProject/en/devices])) and (identifier is not null)";

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Rohit-Negi


Recreate index for the same property and then reindex. It will work.

1 reply

Rohit-Negi
Level 3
September 24, 2021

Hi @abhishekty 

 

Can you change s.derivedInventoryStatus to s.derivedinventorystatus

 

Thanks!

Abhishekty
Level 4
September 24, 2021

No, "s.derivedinventorystatus" is also not working.

Rohit-Negi
Level 3
September 24, 2021

After changing the name I believe you have to update the index as well with the correct name as derivedinventorystatus and reindex.

There is nothing wrong in your query, I ran the same on my end as well, and it is working fine.

 

Thanks!