1
votes

Whenever I send an empty query to Thinking Sphinx it returns all the items in my table. I would assume that an empty query would return back null or an empty array. Does Thinking Sphinx have an option to prevent this behavior.

So for example the following code will return all the rows in Article:

Article.search
1

1 Answers

1
votes

If you do not specify search terms then the search will (by default) be for everything of that type (the object type will be the only filter applied) and so you will get everything back. You should just check your query before you submit it to Thinking Sphinx and return no results if a blank query is passed.