Improvement in getIndexableDocs

It seems to me that getIndexableDocs is buggy and inefficient. I suggest those improvements.