TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Full-Text Search in Django with PostgreSQL

180 点作者 pauloxnet超过 7 年前

10 条评论

agconti超过 7 年前
I can deeply vouch for the performance and joy of implementing Full-Text Search with PostgreSQL and Django.<p>I just finished a a project where we chose Postgres&#x27;s FTS over using Elastic Search. At the beginning, I was worried about what performance we&#x27;d see since we choose to not use ES. But after slight performance tweaking, we had even our least performing queries under 50ms.
评论 #16086375 未加载
评论 #16086488 未加载
评论 #16086354 未加载
评论 #16086582 未加载
评论 #16086573 未加载
yeukhon超过 7 年前
Have worked with ES...<p>If you want the out-of-the-box distributed experience, then you can&#x27;t go wrong with Elasticsearch because of the built-in sharding mechanism. However, figuring out how many shards you need for each index, where should each shard sits, and how to balance out the cluster has always been a trial and error exercise. Indices continue to grow like there is infinite space, and performance will degrade. What I find useful in the end is to have multiple ES clusters, which seems obvious right? One of the most frequently asked questions is &quot;how many nodes do I need&quot;, and the answer is always &quot;it depends&quot; which is true, but gives me a chill. With Cassandra, from my experience, adding more nodes (scale horizontally) so data spread more thinly, and revisit some data structure change, would be an acceptable answer.<p>The other thing is a lot of folks I have worked with just dump stuff into ES because ES feels like a dumping ground for &quot;json&quot;-like documents (reminds of me MongoDB). Please compress, understand mappings and different fields to make the document smaller...<p>I am still very convinced SQL databases are robust enough to take any lazy dumping.
评论 #16087002 未加载
评论 #16086921 未加载
nicolashahn超过 7 年前
We use Flask with SQLAlchemy, this guide on sqlalchemy-searchable:<p><a href="https:&#x2F;&#x2F;sqlalchemy-searchable.readthedocs.io&#x2F;en&#x2F;latest&#x2F;installation.html#quickstart" rel="nofollow">https:&#x2F;&#x2F;sqlalchemy-searchable.readthedocs.io&#x2F;en&#x2F;latest&#x2F;insta...</a><p>had us easily swap out Algolia for search with Postgres FTS.
评论 #16087282 未加载
评论 #16088298 未加载
sandGorgon超过 7 年前
Does anyone know how to play with relevance and spell corrections in FTS ?<p>In elasticsearch, relevance is Tf-IDF or BM25. I don&#x27;t see anything similar in FTS.<p>Not sure how I can results around ranking as well as spell correction&#x2F;suggestions simultaneously.
评论 #16086613 未加载
评论 #16086547 未加载
rpedela超过 7 年前
Can you expand on the difficulty with synchronization? With ES I understand because you have to build it from scratch. However Solr has the DataImportHandler [1] which is made to sync data from a relational database.<p>1. <a href="https:&#x2F;&#x2F;lucene.apache.org&#x2F;solr&#x2F;guide&#x2F;7_2&#x2F;uploading-structured-data-store-data-with-the-data-import-handler.html#dataimporthandler-commands" rel="nofollow">https:&#x2F;&#x2F;lucene.apache.org&#x2F;solr&#x2F;guide&#x2F;7_2&#x2F;uploading-structure...</a>
steve-chavez超过 7 年前
Not to discredit Django but if you&#x27;re already using PostgreSQL you could use <a href="http:&#x2F;&#x2F;postgrest.com" rel="nofollow">http:&#x2F;&#x2F;postgrest.com</a> which is a more tightly knit component for fts.<p>With PostgREST you can avoid the abstractions overhead and just use plain SQL and REST calls, basically to do a fts using `to_tsquery` you would do:<p>CREATE TABLE blog_entry( headline text, body_text tsvector );<p>GET localhost:3000&#x2F;blog_entry?body_text=fts.Cheese&amp;select=headline
评论 #16091422 未加载
penetrarthur超过 7 年前
Why hasn&#x27;t anyone brought up Django Haystack?<p><a href="http:&#x2F;&#x2F;django-haystack.readthedocs.io&#x2F;en&#x2F;master&#x2F;tutorial.html" rel="nofollow">http:&#x2F;&#x2F;django-haystack.readthedocs.io&#x2F;en&#x2F;master&#x2F;tutorial.htm...</a>
评论 #16088292 未加载
pauloxnet超过 7 年前
BTW I migrated the djangoproject.com from ES to PG FTS and it works great <a href="https:&#x2F;&#x2F;github.com&#x2F;django&#x2F;djangoproject.com&#x2F;commit&#x2F;1be9a483fe876d36de35c5ece1000f16eadb0f13" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;django&#x2F;djangoproject.com&#x2F;commit&#x2F;1be9a483f...</a><p>I&#x27;ll write another article about it and, if they vote it, I&#x27;ll have a talk about it in the next PyCon Nove conference <a href="http:&#x2F;&#x2F;www.paulox.net&#x2F;talks&#x2F;#pycon-nove" rel="nofollow">http:&#x2F;&#x2F;www.paulox.net&#x2F;talks&#x2F;#pycon-nove</a>
hitekker超过 7 年前
Does the Django postgres module handle partial word lookups?
kuschku超过 7 年前
Considering your nickname, @OP, I assume you’re the author of the website: The site is currently broken on screens with a width of 1024px or less.<p>This screenshot was taken on my secondary monitor, which is 1280x1024 in portrait mode: <a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;n3LGCKM.png" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;n3LGCKM.png</a>
评论 #16086090 未加载
评论 #16086950 未加载
评论 #16086146 未加载
评论 #16088277 未加载
评论 #16087849 未加载
评论 #16086503 未加载