我正在使用Sphinx,我已经使用更简单的查询成功构建了索引但是当我将COALESCE
和AS
MySQL关键字添加到我的查询中时,我收到错误“没有字段架构 - 不会索引“。我想添加属性,所以我不必查询数据库的id匹配细节,认为它会快一点,如果我使用sql_field_string代替sql_attr_string我不再得到错误和索引构建但它需要三倍建设的时间。
SELECT r.RegistrationId, coalesce(CampaignID,'') as CampaignId, coalesce(FirstName,'') as FirstName, coalesce(LastName,'') as LastName, \
coalesce(Address1,'') as Address1, coalesce(Address2,'') as Address2, coalesce(City,'') as City, coalesce(State,'') as State, \
coalesce(Zip,'') as Zip,coalesce(Email,'') as Email, coalesce(Phone,'') as Phone,coalesce(Affiliate,'') as Affiliate, \
coalesce(SubAffiliate,'') as SubAffiliate \
FROM Registration r WHERE r.CreateDT >= '2013-01-01'
sql_attr_string = CampaignId
sql_attr_string = FirstName
sql_attr_string = LastName
sql_attr_string = Address1
sql_attr_string = Address2
sql_attr_string = City
sql_attr_string = State
sql_attr_string = Zip
sql_attr_string = Email
sql_attr_string = Phone
sql_attr_string = Affiliate
sql_attr_string = SubAffiliate
答案 0 :(得分:4)
索引需要至少一个字段才能运行。这是不容谈判的。
如果你真的不想要任何领域,可以做一个假的。
...,'a'是假的,......
或类似的。索引不会花很长时间。