Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Add sanitize_sql to indexes page

  • Loading branch information...
commit 1ac39b1aab372dbb0bdeea56574c1b19532ba708 1 parent 9ee3223
@mtodd mtodd authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 ts/en/indexing.textile
16 ts/en/indexing.textile
@@ -101,6 +101,22 @@ define_index do
{% endhighlight %}
+h3. SQL
+As previously mentioned, your index definition results in SQL from the indexes, the attributes, conditions and groupings, etc. With this in mind, it may be useful to simplify your index.
+One way would be to use something like @ActiveRecord::Base.sanitize_sql@ to generate the required SQL for you. For example:
+{% highlight ruby %}
+define_index do
+ # ...
+ where sanitize_sql(["published", true])
+{% endhighlight %}
+This will produce the expected @WHERE published = 1@ for MySQL.
h3. Processing your Index
Once you've got your index set up just how you like it, you can run "the rake task":rake_tasks.html to get Sphinx to process the data.
Please sign in to comment.
Something went wrong with that request. Please try again.