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 9155401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:35:10+00:00 2026-06-17T12:35:10+00:00

views.py (relevant part) srch = request.GET.get(‘search’, ) sqs = SearchQuerySet().filter(has_title=True) clean_query = sqs.query.clean(srch) results

  • 0

views.py (relevant part)

srch = request.GET.get('search', "") 
sqs = SearchQuerySet().filter(has_title=True)
clean_query = sqs.query.clean(srch)
results = sqs.raw_search(clean_query)

search_indexes.py

from haystack.indexes import *
from haystack import site
from myproject.myapp.models import Person

class PersonIndex(SearchIndex):
    text = CharField(document=True, use_template=True)
    name = CharField(model_attr='name')    
    has_title = BooleanField(model_attr='has_title')

site.register(Person, PersonIndex)

models.py

class Person(models.Model):
    name = models.CharField(max_length=50) 
    has_title = models.BooleanField()

    def __unicode__(self):
        return u'%s' % self.name

When searching, I get my results out of the complete model instead of only those entries were has_title is True. I also ran python manage.py rebuild_index after applying the filter. Why does the filter not work?

I am using Whoosh 2.4.1, Django-haystack 1.2.7 and Django 1.4.

If someone could just confirm that they can successfully use SearchQuerySet().filter with Whoosh 2.4 and Django-haystack 1.2.7 this would already be a big help.

  • 1 1 Answer
  • 0 Views
  • 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-06-17T12:35:11+00:00Added an answer on June 17, 2026 at 12:35 pm

    It seems that raw_search(clean_query) just returns every item in sqs again (don’t know why), using filter(content=clean_query) instead gets the expected result.

    srch = request.GET.get('search', "") 
    sqs = SearchQuerySet().filter(has_title=True)
    clean_query = sqs.query.clean(srch)
    result = sqs.filter(content=clean_query)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing my views.py, in which i need to get the model instance
Here's the relevant part of my Index view (Index.cshtml): @foreach (var item in Model)
Does NHibernate support inline views using criterias? Google doesn't seem to return any relevant
Drupal 7 with relevant Modules: Views & Entity Reference I have a view that
A part of my application takes in some ingredients then spits back relevant recipes.
my views.py file code: #!/usr/bin/python from django.template import loader, RequestContext from django.http import HttpResponse
DDMS views Database only in eclipse. I want to view table contents from CMD.
In views, is it possible to configure a cck taxonomy field so that a
Typically views appear to output anchors without 'title' attributes. How would you add 'title'
There are 2 views view1 & view2. view1 on left side & view2 on

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.