Jarn / collective.solr

9 stars 1 forks source link

Unindexing not working if unique-key is provided through an indexer #2

Open hannosch opened 13 years ago

hannosch commented 13 years ago

This was reported by Maurizio Delmonte on July 29, 2009 in the old issue tracker at plone.org:

Using Dexterity and collective.solr, i was able to use the suggested UID unique-key providing the following indexer:

from five import grok
from zope.component import queryUtility
from plone.indexer import indexer

@indexer(ICv)
def UID(obj):
  intid=queryUtility(IIntIds, None)
  if intid:
    return intid.queryId(obj)

grok.global_adapter(UID, name="UID")

That is needed because dexterity 1.0a1 is not providing a UID attribute on its content types.

But, in this way, when the SolrIndexProcessor unindex method is called, it can't find the necessary unique-key value. Steps to reproduce:

hannosch commented 13 years ago

With Plone 4.1 including plone.uuid it might be a good idea to require that and always use UID / IUUD(obj) as the unique key instead of making it configurable. That would also solve the Dexterity issue.

witsch commented 13 years ago

sounds like a good plan for 2.0 and up. and as for 1.x we can probably ignore the issue altogether...