django-fulltext-search | Django support for MySQL / MariaDB full-text search | Search Engine library
kandi X-RAY | django-fulltext-search Summary
kandi X-RAY | django-fulltext-search Summary
Django support for MySQL / MariaDB full-text search
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Performs a search against the database
- Create a query set
- Execute a search query
- Get query set
- Get requirements from a file
django-fulltext-search Key Features
django-fulltext-search Examples and Code Snippets
Community Discussions
Trending Discussions on django-fulltext-search
QUESTION
I have a search bar that is searching in 2 models columns title, body, short_description. I am.using MySQL database. Right now, I am using Q lookups but there are some search limitations that I'd like to 'improve'.
One of them is that Q lookups find only results based only on phrase results that are exactly the same as in field so for instance, I have the title why python is so amazing?
and I must write why
or python
or python is
in order to get results. What I'd like to get is to extend the search bar to work in the following way:
A user inserts a question in the search bar: python language
and search lookup is splitting each word and returning all objects that contain python
or language
. In the end the result would return object with why python is so amazing?
, no matter it user puts python language
or amazing python
.
I am posting my current code below:
views.py
...ANSWER
Answered 2022-Mar-05 at 19:54I ran into the same issue, and solved it by adding a custom search manager in models.py, above my model. The manager has two methods, one for single word searches, another for multi-word. The query string is split into a list of words using the .split()
, (see the view) below.
models.py
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-fulltext-search
You can use django-fulltext-search like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page