Added branch 1.0.
[wolnelektury.git] / apps / djangosphinx / apis / api275 / templates / source-multiple.conf
diff --git a/apps/djangosphinx/apis/api275/templates/source-multiple.conf b/apps/djangosphinx/apis/api275/templates/source-multiple.conf
new file mode 100644 (file)
index 0000000..506e6f1
--- /dev/null
@@ -0,0 +1,36 @@
+source {{ source_name }}
+{
+    type                = {{ database_engine }}
+    strip_html          = 0
+    index_html_attrs    =
+    sql_host            = {{ database_host }}
+    sql_user            = {{ database_user }}
+    sql_pass            = {{ database_password }}
+    sql_db              = {{ database_name }}
+    sql_port            = {{ database_port }}
+    log                 = {{ log_file }}
+
+    sql_query_pre       =
+    sql_query_post      =
+    sql_query           = \
+{% for table_name, content_type in tables %}
+        SELECT {{ field_names|join:", " }}, {{ content_type.id }} as content_type \
+        FROM `{{ table_name }}`{% if not loop.last %} UNION \{% endif %}
+{% endfor %}
+{% if group_columns %}
+    # ForeignKey's
+{% for field_name in group_columns %}    sql_attr_uint       = {{ field_name }}
+{% endfor %}{% endif %}
+{% if date_columns %}
+    # DateField's and DateTimeField's
+{% for field_name in date_columns %}    sql_attr_timestamp   = {{ field_name }}
+{% endfor %}{% endif %}
+{% if bool_columns %}
+    # BooleanField's
+{% for field_name in bool_columns %}    sql_attr_bool        = {{ field_name }}
+{% endfor %}{% endif %}
+{% if float_columns %}
+    # FloatField's and DecimalField's
+{% for field_name in float_columns %}    sql_attr_float       = {{ field_name }}
+{% endfor %}{% endif %}
+}
\ No newline at end of file