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

  • Home
  • SEARCH
  • 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 6063305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:09:03+00:00 2026-05-23T09:09:03+00:00

I have been trying to get xapian working django haystack for a project im

  • 0

I have been trying to get xapian working django haystack for a project im working on that requires some search functionality but have run into a bit of a wall!! Basically i got everything installed per the instructions, so:

ran make install for xapian-core and the xapian bindings
ran pip install haystack and pip install xapian-haystack and everything installed correctly

As im using the django cms app i simply copied thier example over to give the search functionality a test and ran into this error

InvalidIndexError at /search/
Unable to open index at /home/mike/sites/xapian_search

I have tried several different paths for the HAYSTACK_XAPIAN_PATH setting and have also encountered another error

OSError at /
(13, 'Permission denied')

the folder xapain_search has been given full perms (chmod 777) and theres an xapian_index.php file with full perms too. Im not sure what im missing here but im desperate to try and get this working!!

my haystack settings look like

HAYSTACK_SITECONF = 'lactoseintolerant.lactose_search'
HAYSTACK_SEARCH_ENGINE = 'xapian'
HAYSTACK_XAPIAN_PATH = '/home/mike/sites/xapian_search'
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 50

Any advice would be greatly appreciated!!

edit

Hey again
i think this error is relating to the fact that there are no indexes(is that right?) i have run the commands update_index rebuild_index clear_index all of which dont seem to do anything, there are no errors outputted but still the indexs never seem to be built when the commands are run

i have an app called lactose_search which my HAYSTACK_SITECONF points to like so projectname.lactose_search in this app folder i have a file called search_indexs.py. For now i have simply c+p the example from the django cms site as it is the cms_app content i want to search
this file looks like

from django.conf import settings
from django.utils.translation import string_concat, ugettext_lazy

from haystack import indexes, site

from cms.models.managers import PageManager
from cms.models.pagemodel import Page

def page_index_factory(lang, lang_name):
if isinstance(lang_name, basestring):
    lang_name = ugettext_lazy(lang_name)

def get_absolute_url(self):
    return '/%s%s' % (lang, Page.get_absolute_url(self))

class Meta:
    proxy = True
    app_label = 'cms'
    verbose_name = string_concat(Page._meta.verbose_name, ' (', lang_name, ')')
    verbose_name_plural = string_concat(Page._meta.verbose_name_plural, ' (', lang_name, ')')
    
attrs = {'__module__': Page.__module__, 
         'Meta': Meta,
         'objects': PageManager(),
         'get_absolute_url': get_absolute_url}

_PageProxy = type("Page%s" % lang.title() , (Page,), attrs)

_PageProxy._meta.parent_attr = 'parent'
_PageProxy._meta.left_attr = 'lft'
_PageProxy._meta.right_attr = 'rght'
_PageProxy._meta.tree_id_attr = 'tree_id'

class _PageIndex(indexes.SearchIndex):
    language = lang
    
    text = indexes.CharField(document=True, use_template=False)
    pub_date = indexes.DateTimeField(model_attr='publication_date')
    login_required = indexes.BooleanField(model_attr='login_required')
    url = indexes.CharField(stored=True, indexed=False, model_attr='get_absolute_url')
    title = indexes.CharField(stored=True, indexed=False, model_attr='get_title')
    
    def prepare(self, obj):
        self.prepared_data = super(_PageIndex, self).prepare(obj)
        plugins = obj.cmsplugin_set.filter(language=lang)
        text = ''
        for plugin in plugins:
            instance, _ = plugin.get_plugin_instance()
            if hasattr(instance, 'search_fields'):
                text += ''.join(getattr(instance, field) for field in instance.search_fields)
        self.prepared_data['text'] = text
        return self.prepared_data
    
    def get_queryset(self):
        return _PageProxy.objects.published().filter(title_set__language=lang, publisher_is_draft=False).distinct()

return _PageProxy, _PageIndex

for lang_tuple in settings.LANGUAGES:
   lang, lang_name = lang_tuple
    site.register(*page_index_factory(lang, lang_name))

and can be found here http://docs.django-cms.org/en/2.1.3/extending_cms/searchdocs.html

Hope this extra info may make answering this question abit easier!

  • 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-05-23T09:09:03+00:00Added an answer on May 23, 2026 at 9:09 am

    I figured out what my issue was here, when i installed the packages to my env i ran sudo pip install instead of simply using pip. I cant explain why this affected the haystack install but once i removed all the packages and re-installed them i managed to get haystack running

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

Sidebar

Related Questions

Have been trying to get integration testing working with my seam project and the
Hi I have been trying to get this script http://jsbin.com/ipajo5/ working but using .live()
I have been having some problems trying to get my PHP running. When I
I have been trying to get this program to work but so far having
I have been trying to get this to work. Basically I have a search
I have been trying to get a 2-way ssl/https proxy working with Camel. I
I have been trying to get around this error for a day now and
I have been trying to get more in to TDD. Currently keeping it simple
I have been trying for a long time to get SQL Server Express on
I have been trying to work my way through Project Euler, and have noticed

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.