Reputation: 522
I'm trying add int primary key as a sql_field_string, when I'm rotate index I get message: WARNING: attribute 'purchase_id' not found - IGNORING
my config:
sp_purchases_source : sp_source_config
{
sql_query = \
SELECT sp_purchase.id AS purchase_id, sp_purchase.status, sp_purchase.name, sp_purchase.description_small, sp_purchase.description_full, sp_purchase.news,\
UNIX_TIMESTAMP(sp_purchase.date_current) AS date_current, UNIX_TIMESTAMP(sp_purchase.stop_date) AS stop_date, sp_purchase.image, sp_purchase.access, \
sp_purchase.is_vip, sp_purchase.is_foreign, sp_purchase.owner_username, sp_purchase.owner_id, sp_purchase.count_users, sp_purchase.count_comments \
FROM sp_purchase \
WHERE sp_purchase.is_hidden = 0 AND sp_purchase.status IN (2,4,17)
sql_ranged_throttle = 0
sql_field_string = purchase_id
sql_field_string = name
sql_field_string = description_small
sql_field_string = description_full
sql_field_string = owner_username
sql_field_string = news
sql_attr_timestamp = date_current
sql_attr_timestamp = stop_date
sql_attr_string = image
sql_attr_uint = access
sql_attr_uint = owner_id
sql_attr_uint = status
sql_attr_bool = is_vip
sql_attr_bool = is_foreign
sql_attr_uint = count_users
sql_attr_uint = count_comments
}
how I can add id field in index?
Upvotes: 0
Views: 161
Reputation: 21091
Well the document-id is already a virtual attribute. It works just like a real attribute.
So can filter/sort/group by id.
sphinxql> SELECT id,name FROM sp_purchases WHERE id BETWEEN 10 and 20;
... to make it a field, have to be a bit more tricky, eg duplicate it twice.
sql_query = \
SELECT sp_purchase.id, sp_purchase.id AS purchase_id, sp_purchase.status, ...
The first column is always the document-id, so will be used for virtual attribute.
So leaves purchase_id
to be a 'standard' field.
Upvotes: 1