如何使用 python 构建交互式搜索引擎 Web 界面

发布于 2024-08-28 00:49:19 字数 290 浏览 4 评论 0原文

我已经构建了一个静态 Web 界面,用于从 PostgreSQL 数据库中的某些表中搜索数据。查询网站由一个用于输入搜索词的简单文本字段组成,结果网站将结果显示为一个简单的 html 表格。用于搜索 PostgreSQL 数据库并返回结果的服务器端代码是使用 psycopg2 用 python 编写的。

现在我想向我的搜索引擎添加一些交互式“Ajax 功能”。当输入搜索词时,我希望能够看到可能的搜索词列表,就像谷歌那样。在结果页面上,我希望能够对显示结果的表格进行排序。

为我的搜索引擎网站实现这些功能的最简单/推荐的方法是什么?

I have build a static web interface for searching data from some tables in my PostgreSQL database. The query website consists of a simple textfield for entering the search term, the result website presents the results as a simple html table. The server side code for searching the PostgreSQL database and returning the results is written in python using psycopg2.

Now I would like to add some interactive "Ajax features" to my search engine. When entering the search term I would like to be able to see a list of possible search terms like Google does it. On the results page, I would like to be able to sort the table showing the results.

What would be the easiest/recommended way to implement these features for my search engine web site?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独自←快乐 2024-09-04 00:49:19

我不必在 Django 之外构建搜索,但是 Haystack http://haystacksearch.org/ 让事情变得非常简单简单的。

如果你不想了解 Django,你可以看看 Whoosh。 http://bitbucket.org/mchaput/whoosh/wiki/Home

I have not had to build a search outside of Django, but Haystack http://haystacksearch.org/ makes things very easy.

If you don't want to get into Django you could look at Whoosh. http://bitbucket.org/mchaput/whoosh/wiki/Home

风轻花落早 2024-09-04 00:49:19

您所说的“Ajax 功能”在技术上称为自动建议。除非你想重新发明轮子。我强烈建议使用 Apache Solr 为数据库表建立索引。它配备了自动建议、分面过滤(就像大多数电子商务网站一样)和拼写检查。由于它是基于 HTTP 的,因此您可以使用其 RESTful API 非常轻松地连接到 Python。

what you call "Ajax features" are technically known as auto-suggest. Unless you want to reinvent the wheel. I would highly recommend indexing your db tables using Apache Solr. It comes with autosuggest, faceted filtering (like on most ecommerce sites) and spell-check. and since it is HTTP based you can hook into Python very easily using its RESTful API.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文