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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:09:18+00:00 2026-05-17T01:09:18+00:00

I’ve read the getting started documentation and several other examples on the web. And

  • 0

I’ve read the getting started documentation and several other examples on the web.
And this is what my search_indexes.py looks like:

from haystack.indexes import *
from haystack import site
from models import Entry

class EntryIndex(SearchIndex):
    text = CharField(document=True)
    headline = CharField(model_attr='headline')
    subheadline = CharField(model_attr='subheadline')
    category = CharField(model_attr='category__name')

    author = CharField(model_attr='get_author')
    email = CharField(model_attr='get_email')

    tags = CharField(model_attr='tags')

    content = CharField(model_attr='content')

    def get_queryset(self):
        return Entry.objects.exclude(dt_published=None).order_by('-is_featured', '-dt_published', '-dt_written', 'headline')

site.register(Entry, EntryIndex)

But when I search, I get no results. Strangely though if I use the search phrase ‘a’ or any other single letter,
I get what looks like every single entry in the damn thing.

Anyway… It looks to me like the search engine isn’t looking in any of the fields. :/

Anything below this line is less relevant (it works, trust me):


My view:

from haystack.views import SearchView

class CustomSearchView(SearchView):
    def __name__(self):
        return "CustomSearchView"

    def extra_context(self):
        return common(self.request)

def search(request):
    return CustomSearchView(template='news/search_results.html')(request)

And search_results.html:

{% extends "content.html" %}
{% load tagging_tags %}
{% load highlight %}


{% block title %}Viðskiptablaðið - Leitarniðurstöður{% endblock %}

{% block left_content %}

<h2>Search</h2>

<form method="get">
    <table>
        {{ form.as_table }}
        <tr>
            <td>&nbsp;</td>
            <td>
                <input type="submit" value="Search">
            </td>
        </tr>
    </table>

    {% if query %}
        <h3>Results</h3>

        {% for result in page.object_list %}
            {% highlight result.summary with request.GET.q %}
            {% highlight result.object.headline with request.GET.q %}
            <p>
                <a href="{{ result.object.get_absolute_url }}">{{ result.object.headline }}</a>
            </p>
        {% empty %}
            <p>No results found.</p>
        {% endfor %}

        {% if page.has_previous or page.has_next %}
            <div>
                {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
                |
                {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
            </div>
        {% endif %}
    {% else %}
        {# Show some example queries to run, maybe query syntax, something else? #}
    {% endif %}
</form>

{% endblock %}
  • 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-17T01:09:18+00:00Added an answer on May 17, 2026 at 1:09 am

    ok, it is in the documentation but I feel it’s not clear enough.

    What you have to do is to declare somehow the data to be searched (i thought that was the whole point of:

    headline = CharField(model_attr='headline')
    subheadline = CharField(model_attr='subheadline')
    

    etc…)

    ok, enough crying.

    All you have to do is

    text = CharField(document=True, use_template=True)
    

    and then make a template, in my case:

    search/indexes/news/entry_text.txt

    {{ object.headline }}
    {{ object.subheadline }}
    {{ object.get_author }}
    {{ object.get_email }}
    {{ object.category.name }}
    {{ object.tags }}
    {{ object.content }}
    

    Beautiul, it works.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.