Comments (1)
First, is there a reason that you're using the docs for 2.10? We're currently on 3.17 and 2.10 is a very old release.
To answer your question, however, no there is just too much variety in the way people store and structure their search corpora. The best way is to wrap it up in helper functions as you intend to use it. Many people will wish to store the tsvector of their search content in an indexed TSVectorField
(see docs).
I'd suggest something like the following:
def search_expression(text):
query = fn.phraseto_tsquery(text)
content = fn.to_tsvector('english', Document.summary.concat(' ').concat(Document.metadata.cast('text')))
return Expression(content, '@@', query)
Document.select().where(search_expression('the search text'))
Note you may also wish to use websearch_to_tsquery
.
from peewee.
Related Issues (20)
- Implement __deepcopy__ and __copy__ methods in Node HOT 10
- Connection won't be recycled after a while HOT 1
- Question regarding transferring tables between two databases HOT 1
- support for fn.PERCENTILE_CONT HOT 1
- Inherited hybrid properties not using ModelAlias
- Peewee installation fails HOT 2
- Installation broken: No module named 'peewee' (v3.17.4) HOT 4
- upsert shortcut for postgresql HOT 2
- Wrong table order in `delete_instance(recursive=True)` causes missing deletion HOT 3
- Performance bottleneck due to locking operations in PooledMySQLDatabase HOT 1
- Hot work "in" HOT 2
- Does db.close() exactly close the database connection in network layer? HOT 1
- Best practices: how to manage classes that may or may not have database data HOT 10
- playhouse.postgres_ext.ServerSide doesn't create server-side cursor HOT 2
- model to dict -> subquery fields HOT 1
- Regression of < used on connections HOT 4
- Correct way to migrate a table to update a ForeignKeyConstraint with `ON DELETE CASCADE` HOT 1
- the count is diffrent HOT 3
- Bind schema - similar to how we can bind database to a model HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from peewee.