简体   繁体   English

在简单的上下文中解释搜索(Sphinx / Haystack)?

[英]Explain search (Sphinx/Haystack) in simple context?

Could you explain how search engines like Sphinx, Haystack, etc fit in to a web framework. 您能否解释一下狮身人面像,干草堆等搜索引擎如何适应Web框架。 If you could explain in a way that someone new to web development could understand that would help. 如果您能以某种方式解释一下,使Web开发的新手可以理解这将有所帮助。

One example use case I made up for this question is a book search feature. 我为这个问题准备的一个示例用例是图书搜索功能。 Lets say I have a noSQL database that contains book objects, each containing author, title, ISBN, etc.; 假设我有一个noSQL数据库,其中包含书籍对象,每个对象都包含作者,书名,ISBN等; how does something like Sphinx/Haystack/other search engine fit in with my database to search for a books with a given ISBN? Sphinx / Haystack /其他搜索引擎如何与我的数据库配合以搜索具有给定ISBN的图书?

Firstly, Haystack isn't a search engine, it's a library that provides a Django API to existing search engines like Solr and Whoosh. 首先,Haystack不是搜索引擎,而是一个为现有搜索引擎(如Solr和Whoosh)提供Django API的库。

That said, your example isn't really a very good one. 就是说,您的例子并不是一个很好的例子。 You wouldn't use a separate search engine to search by ISBN, because your database would already have an index on the Book table which would efficiently do that search. 您不会使用单独的搜索引擎来按ISBN进行搜索,因为您的数据库已经在Book表上具有一个索引,可以有效地执行该搜索。 Where a search engine would come in could be in two places. 搜索引擎可能会出现在两个地方。 Firstly, you could index some or all of the book's contents to search on: databases are not very good at full-text search, but this is an area where search engines shine. 首先,您可以对本书的部分或全部内容建立索引以进行搜索:数据库在全文搜索方面不是很擅长,但这是搜索引擎大放异彩的领域。 Secondly, you could provide a search against multiple fields - say, author, title, publisher and description - in one go. 其次,您可以一次搜索多个字段,例如作者,标题,出版者和描述。

Also, search engines provide useful functionality like suggestions, faceting and so on that you won't get from a database. 而且,搜索引擎提供了有用的功能,例如建议,构面等,这些功能是您无法从数据库中获得的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM