Ask Your Question
1

Haystack test 'test_user_profile_search' fails

asked 2013-09-28 05:44:02 -0600

apg gravatar image

updated 2013-09-28 18:33:52 -0600

Could someone take a look at this test failure?

I get the following failure:

/home/a/virtualenv/4hou4ken/bin/python2.7 /media/sf_Ubuntu/4hou4ken/forum/manage.py test askbot.HaystackSearchTests WARNING!!! You are using a 'locmem' (local memory) caching backend, which is OK for a low volume site running on a single-process server. For a multi-process configuration it is neccessary to have a production cache system, such as redis or memcached.

With local memory caching and multi-process setup you might intermittently see outdated content on your site.

Creating test database for alias 'default'... ...F ====================================================================== FAIL: test_user_profile_search (askbot.tests.haystack_search_tests.HaystackSearchTests) ---------------------------------------------------------------------- Traceback (most recent call last):
File "/media/sf_Ubuntu/4hou4ken/askbot/askbot/tests/haystack_search_tests.py", line 84, in test_user_profile_search self.assertEquals(user_profile_qs.count(), 1) AssertionError: 0 != 1

---------------------------------------------------------------------- Ran 4 tests in 17.870s

FAILED (failures=1) Destroying test database for alias 'default'...

Process finished with exit code 1

As I judge from the Solr Admin, "wood" is not index because querying for "wood" returns no record of it. For this reason, I am suspecting this may be caused by schema.xml being improperly configured. Thank you.

Update1(Wrong):

I am guessing the above failure may be caused by the following code in askbot/search/haystack/__init__.py because Django's User class does not have location or about field.

def get_model(self): from askbot.models import User return User

I tried to extend the User class in askbot/models/user.py So far, it is unsuccessful because I got errors such as

askbot.activity: 'user' has a relation with model <class 'askbot.models.user.user'="">, which has either not been installed or is abstract.</class>

Update2: Maybe solved?

It turned out adding the following two lines to

askbot/templates/search/indexes/auth/user_text.txt

made the test to pass

{{ object.about }}

{{ object.location }}

{{object.country}} may be added too. But, I am not sure on this because this may index country even if show_country is false.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-09-28 22:01:18 -0600

Evgeny gravatar image

Thank you, applied your suggestion in the repository.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-09-28 05:44:02 -0600

Seen: 104 times

Last updated: Sep 28 '13