I have tried to search a customer ID through a column using the executeSearchQuery() Nodejs SDK method. But, it returns an empty value. I already have the Customer ID in the Customer Catalyst Datastore table. How to resolve this issue? I have attached a code snippet which I have tried to search through a column.
app.get("/search", async (req, res) => {
var CatalystApp = catalyst.initialize(req);
var searchQuery = {
search: "10090",
search_table_columns: {
Customer: ["Customer_ID"],
Customer: ["Order_customer"],
},
};
//search query
CatalystApp.search()
.executeSearchQuery(searchQuery)
.then((resp) => {
console.log("resp :", resp);
res.status(200).send(resp);
})
.catch((err) => {
console.log(err);
res.status(500).send(err);
});
});```
The output is [![here](https://i.sstatic.net/BHnNc0jz.png)](https://i.sstatic.net/BHnNc0jz.png)
You can check on the Datastore table schema view [![here](https://i.sstatic.net/pzWhTZ6f.png)](https://i.sstatic.net/pzWhTZ6f.png)
As checked with the screenshot of the Catalyst Datastore table schema view, I can see that you might not have enabled the search index. Hence, you didn't get any value. To resolve this issue, enable the search index for both columns and try to search the customer ID in both columns using the Nodejs SDK method. You can click on the Edit button in the column and enable the Search Index. You can find their help documentation here