Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 714821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:07:04+00:00 2026-05-14T05:07:04+00:00

I have a really simple blog application and I want to add a really

  • 0

I have a really simple blog application and I want to add a really simple search feature to it.

There are 3 key fields to my model.

class BlogPost(models.Model):
    title = models.CharField(max_length=100) # the title
    intro = models.TextField(blank=True, null=True) # an extract
    content = models.TextField(blank=True, null=True) # full post

I don’t need a Google. I don’t want to search comments (which are held on Disqus anyway). I just want a date-ranked, keyword filtered set of posts.

Everything I find on Google for some form of “django” and “search” comes back with hideously complicated Haystack+backend solutions. I don’t need all that. I don’t want to eat up more resources on a low-usage feature (I used to have a search box before I ported to Django and it had perhaps 4 searches a month).

The reason I’m taking time to ask on here (rather than just writing a messy little script) is this already exists in the admin. You can set the columns to search on and then just search and it “just works”.

Is there some way of getting a handle on the admin-provided search and pulling it into my user-facing app?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:07:05+00:00Added an answer on May 14, 2026 at 5:07 am

    If you want a really simple search you can use icontains lookup and Q object:

    from django.db.models import Q
    results = BlogPost.objects.filter(Q(title__icontains=your_search_query) | Q(intro__icontains=your_search_query) | Q(content__icontains=your_search_query))
    

    You should also note that Haystack doesn’t have to be “hideously complicated”. You can set up haystack with Whoosh backend in less then 15 minutes.

    Update 2016: In version 1.10 Django added a full text search support (PostgreSQL only). An answer to the original question using the new module might look something like this:

    from django.contrib.postgres.search import SearchVector
    
    results = BlogPost.objects.annotate(
        search=SearchVector('title', 'intro', 'content'),
    ).filter(search=your_search_query)
    

    The new full text search module contains a lot more features (for example sorting by relevancy), you can read about them in the documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a really simple search form with the following Label (Search) Textbox (fixed
I have a really simple ASP.NET web application and a web setup project that
I have a really simple WPF UserControl: <UserControl x:Class=dr.SitecoreCompare.WPF.ConnectionEntry xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Name=connEntry BorderBrush=Navy BorderThickness=1
I have a really simple Java class that effectively decorates a Map with input
I have a really simple class with two methods; One that will be called
I have a really simple Rails app. Basically an article with comments. I want
I have a simple post AR class/table. Its based on the blog tutorial so
I have a simple blog application written in Python, using Django. I use Git
I have a really simple jQuery script which when an input element is focused
I have a really simple XML file that I'm trying to read, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.