开发者

Rails + SQLite3: Search?

I'm currently building an e-commerce website that's going to be backed by a SQLite3 database. I'm looking for a way to do an in-browser search, with the results being links to products that match the search query. I've got no idea where to start. Any suggest开发者_运维技巧ions?


Why? If you have enough products that you need search, use a database that will grow with you. SQLite is more for development and small/low-traffic applications. For example, Google Chrome uses it to store your history.

For very basic search, SQL-based finding is okay. You can do

SELECT * FROM foo WHERE bar LIKE "%query%" LIMIT 10;

…fairly easily, and relatively quickly (especially since you're using an index on that column, right?).

For more advanced or high-performance search with conditions, partial matches and searching across tables, you can use SOLR or another third-party search-specific application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜