We can use search_api_query function to get the results by passing index machine name and search key word as follows:
$index = 'nodes_index';
$keyword = 'learn subjects';
$query = search_api_query($index);
$query->keys($keyword);
$query->range(0,4);
$results = $query->execute();
No comments:
Post a Comment
Your comment is so valuable as it would help me in my growth of knowledge.