user795347
user795347

Reputation: 11

Thinking Sphinx returns all results with empty query

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

Upvotes: 1

Views: 1484

Answers (1)

Femi
Femi

Reputation: 64710

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.

Upvotes: 1

Related Questions