If you are willing to experiment with this - take a look at function askbot.models.question.ThreadManager.get_for_query(), there is also a more complex function in the same class called run_advanced_search().