1

Haystack test 'test_user_profile_search' fails

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.

apg's avatar
167
apg
asked 2013-09-28 05:44:02 -0500, updated 2013-09-28 18:33:52 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

Thank you, applied your suggestion in the repository.

Evgeny's avatar
13.2k
Evgeny
answered 2013-09-28 22:01:18 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments