Updating/rebulding index effects other solr cores

58 views
Skip to first unread message

Dave

unread,
Mar 20, 2012, 11:51:44 AM3/20/12
to django-haystack
I have two sites that are running on a multi-core solr setup. They
both use the same code base (but have separate databases, similar
products). When i rebuild or update the index on one site, it effects
the other site. Any ideas whats going on?

When i update or rebuild, I get the correct model object count from
each site (it says something like 'indexing X products now, etc).

I believe whats going on is:
If i update/rebuild on site A, then the matching products between the
two sites are updated/rebuilt on site B... so if site A has 100
products, 20 of them match on site B, then site B will only have those
20 products, and same happens reverse.

I can't tell exactly if that is what is going on due to the large
number of products (and a large number of similar products between the
two sites), but I'm pretty sure that is whats happening.

I'm mainly seeing this because site A has a very nice facet structure,
where site B does not. If i update site B, my facets go to hell on
site A (because there is a small number of facets shared between the
two sites). If I update site A, then the facets that site B shares
with site A are updated.

Ideas?
Thanks!
Dave

Danny Adair

unread,
Mar 20, 2012, 4:03:45 PM3/20/12
to django-...@googlegroups.com
Hi Dave,
when you say "sites" you mean haystack SearchSite instances?
Do you use haystack.autodiscover()? Which version of haystack are you using?

Cheers,
Danny

> --
> You received this message because you are subscribed to the Google Groups "django-haystack" group.
> To post to this group, send email to django-...@googlegroups.com.
> To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.
>

--
Kind regards,

Danny W. Adair
Director
Unfold Limited
New Zealand

Talk:       +64 - 9 - 9555 101
Fax:        +64 - 9 - 9555 111
Write:      danny...@unfold.co.nz
Browse:     www.unfold.co.nz
Visit/Post: 253 Paihia Road, RD 2, Kawakawa 0282, New Zealand

"We are what we repeatedly do. Excellence, then, is not an act but a habit."

==============================
Caution
The contents of this email and any attachments contain information
which is CONFIDENTIAL to the recipient. If you are not the intended
recipient, you must not read, use, distribute, copy or retain this
email or its attachments. If you have received this email in error,
please notify us immediately by return email or collect telephone call
and delete this email.  Thank you.  We do not accept any
responsibility for any changes made to this email or any attachment
after transmission from us.
==============================

Dave Brown

unread,
Mar 20, 2012, 7:02:34 PM3/20/12
to django-...@googlegroups.com
Danny,
Two sites as in two different websites/django projects, each with their own SearchSite instance, using haystack.autodiscover()
I'm using 1.2.X I believe.

Thanks!
Dave
Dave Brown
CEO/Founder
Rampframe.com - Action Sports Network

Danny Adair

unread,
Mar 20, 2012, 7:17:24 PM3/20/12
to django-...@googlegroups.com
On Wed, Mar 21, 2012 at 12:02, Dave Brown <wakeb...@gmail.com> wrote:
> Danny,
> Two sites as in two different websites/django projects, each with their own
> SearchSite instance, using haystack.autodiscover()
> I'm using 1.2.X I believe.

I see. So these _projects_ are importing models from each other?
http://django-haystack.readthedocs.org/en/v1.2.6/searchsite_api.html#autodiscovery

The index will be determined from the default site:
haystack.site.get_index(MyModel)
if there's some importing going on between the projects haystack.site
may be returning "the other site"?
That's what it smells like.

P.S.: I believe this is all different in 2.0 but haven't looked at it yet.

Cheers,
Danny

Dave Brown

unread,
Mar 20, 2012, 8:01:32 PM3/20/12
to django-...@googlegroups.com
They aren't importing models from each other, but are overwriting the other sites index with the models that are in the site that is suppose to be getting updated (since both sites have some of the same products, there is an overlap...(same as in a 'copy', not same as in pulling from a shared database).

So for example
Site one has products: A B C
Site two has products B C D

If i update/rebuild site one, site one gets A B C (correct), and site two now only has B C
If I update/rebuild site two, site two gets B C D (correct) and site one now only has B C

Dave

Danny Adair

unread,
Mar 20, 2012, 8:35:55 PM3/20/12
to django-...@googlegroups.com
On Wed, Mar 21, 2012 at 13:01, Dave Brown <wakeb...@gmail.com> wrote:
> They aren't importing models from each other, but are overwriting the other
> sites index with the models that are in the site that is suppose to be
> getting updated (since both sites have some of the same products, there is
> an overlap...(same as in a 'copy', not same as in pulling from a shared
> database).

So project One has a model B and C, and so does project Two - files
copied/symlinked?
Are boths project in the same virtual environment / sharing the same
haystack module?

The default will be haystack.sites.site - if you import _something_
from project One into project Two that can trigger other imports with
your autodiscover() possibly being called again

Cheers,
Danny

Dave Brown

unread,
Mar 20, 2012, 8:45:09 PM3/20/12
to django-...@googlegroups.com
Dan:  My replies prepended with '>>>'

So project One has a model B and C, and so does project Two - files
copied/symlinked?
>>>I'm only using one model, but objects A B C D (for the example).

Are boths project in the same virtual environment / sharing the same
haystack module?
>>>Yes they are sharing the same haystack module.  

The default will be haystack.sites.site - if you import _something_
from project One into project Two that can trigger other imports with
your autodiscover() possibly being called again
>>>They both import the same base app that includes the haystack indexes, models, etc.  But they don't import anything from each other.. each project is basically a settings file and templates.

Thanks again for your help, i really appreciate it
Dave

Danny Adair

unread,
Mar 20, 2012, 8:53:45 PM3/20/12
to django-...@googlegroups.com
On Wed, Mar 21, 2012 at 13:45, Dave Brown <wakeb...@gmail.com> wrote:
>[...]

> So project One has a model B and C, and so does project Two - files
> copied/symlinked?
>>>>I'm only using one model, but objects A B C D (for the example).

Ah, misunderstanding. Sorry I did mean "model class" not "instance".

>>>>They both import the same base app that includes the haystack indexes,
>>>> models, etc.  But they don't import anything from each other.. each project
>>>> is basically a settings file and templates.

So you defined two indexes for the same model in the same (base) app?
And that app uses the default haystack.sites.site via autodiscover()?
That sounds dangerous - I actually asked a few days ago whether it was
even possible (no reply yet).

When you update the index for an object I believe something like this happens:

search_index = haystack.site.get_index(model_class)
search_index.update_object(instance)

but in your setup the first line "get me the index for this
model_class" has more than one answer?

Cheers,
Danny

Dave Brown

unread,
Mar 20, 2012, 9:00:02 PM3/20/12
to django-...@googlegroups.com
Danny,


So you defined two indexes for the same model in the same (base) app?
And that app uses the default haystack.sites.site via autodiscover()?
That sounds dangerous - I actually asked a few days ago whether it was
even possible (no reply yet).
>>>>No i only have one index in the base app, each parent app is setup on its own solr core. 

Dave


--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.

Reply all
Reply to author
Forward
0 new messages