不使用auto_increment id的Sphinx [英] Sphinx without using an auto_increment id

查看:182
本文介绍了不使用auto_increment id的Sphinx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在计划创建一个大型数据库(2+百万行),其中包含来自不同来源的各种数据.我想避免围绕auto_increment id来结构化数据库,以帮助防止复制出现同步问题,并且还因为插入的每个项目都将具有保证唯一的字母数字产品代码-在我看来,改用它是更合理的选择.

I am current in planning on creating a big database (2+ million rows) with a variety of data from separate sources. I would like to avoid structuring the database around auto_increment ids to help prevent against sync issues with replication, and also because each item inserted will have a alphanumeric product code that is guaranteed to be unique - it seems to me more sense to use that instead.

我正在寻找一个搜索引擎来对该数据库建立索引,Sphinx看起来很吸引人,因为它的设计围绕关系数据库建立索引.但是,查看各种教程和文档似乎表明数据库设计依赖于一种或另一种形式的auto_increment字段以及相当粗体语句,表示文档ID只能是32/64位整数,否则会损坏.

I am looking at a search engine to index this database with Sphinx looking rather appealing due to its design around indexing relational databases. However, looking at various tutorials and documentation seems to show database designs being dependent on an auto_increment field in one form or another and a rather bold statement in the documentation saying that document ids must be 32/64bit integers only or things break.

是否有一种方法可以让Sphinx为数据库建立索引,而无需将auto_increment字段作为ID?

Is there a way to have a database indexed by Sphinx without auto_increment fields as the id?

推荐答案

sphinx只要求id为整数和唯一,它不在乎它们是否自动递增,因此您可以推出自己的逻辑.例如,为您的字符串键生成整数散列.

sphinx only requires ids to be integer and unique, it doesn't care if they are auto incremented or not, so you can roll out your own logic. For example, generate integer hashes for your string keys.

这篇关于不使用auto_increment id的Sphinx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆