Try to use AEM Chrome plugin: AEM Chrome Plug-in - Chrome Web Store,It will allow you to see teh exact query that your code executes, determine if it's traversal and hence you need to work with indexes and test the query output from AEM Chrome Plugin in AEM Explain Query tool.