Closed (fixed)
Project:
Apache Solr Search
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Apr 2012 at 18:52 UTC
Updated:
20 Jun 2012 at 19:35 UTC
Jump to comment: Most recent file
Comments
Comment #1
iamEAP commentedActually, this may be more than just a simple typo.
New installations since update_7013 was introduced will have the wrong primary key. We have to introduce a new update that fixes the primary key.
Comment #2
nick_vhHmm,
this is actually not wrong. All other tables should not be unique on entity_type since entity_type for apachesolr_index_entities_node is always node, the only table where this is different must be apachesolr_index_entities, because multiple entity types can be indexed here?
Marking as closed won't fix unless you can show me why this is problematic and why this would speed up queries?
Comment #3
iamEAP commentedHere's a screenshot from the Schema module's schema comparison report page:
This isn't a query speed up issue, this is to say that there's an error in the way the schema is declared which requires a correction via a new hook_update_N().
Comment #4
nick_vhWhen I do the install of schema, it does not report any problems to me :
Update 7013 already does db_add_primary_key('apachesolr_index_entities', array('entity_id', 'entity_type'));
I still can't see the mistake, and other should not be changed to apachesolr_index_entities ($type versus $table)
Comment #5
nick_vhComment #6
iamEAP commentedI believe the inconsistency only happens if you install a fresh copy of apachesolr, since fresh installs don't go through all of the hook_update_N() calls.
In the end, as you said, we want the apachesolr_index_entities table to have a primary key which consists of both entity_id and entity_type because it can include entities of all sorts. Currently, due to this typo (which checks for the key "other" when $type is a value, not a key)...
If you freshly install the module, the apachesolr_index_entities table will only include entity_id in its primary key because that's what's declared in the schema. The above portion of the patch will realign apachesolr_index_entities to what the primary key should be.
However, anyone who's cleanly installed the module as of update_7013 will have the wrong schema, even if we just add the above typo fix. As a result, to take care of people who are in this state, we have to add a new update_7014 that fixes the primary key for that table.
For those who installed the module awhile ago and went through the update process through 7013, update_7015 should have no effect at all.
Comment #7
nick_vhWhat is not correct here? $type is the id of the value. Perhaps you are not looking at latest dev?
Comment #8
iamEAP commentedAh, here we go.
The code you referenced was added (here) on February 24th; the schema was changed (here) on February 2nd to add the dual primary key.
Apachesolr Beta16 (which is what I cleanly installed with) was released with the schema change (latter patch), but not the schema mismatch fix (former patch). We still need an update to fix the schema for those in my shoes who cleanly installed with Beta16.
Here's the patch with just the update.
Comment #9
nick_vhCommitted to D7. Thanks for your quick replies!
This is not applicable to 6.x-3.x so marking as fixed
Comment #10
nick_vh