Forums / Developer / Update Solr Index after object import ?

Update Solr Index after object import ?

Author Message

H-Works Agency

Tuesday 21 September 2010 4:15:06 am

Hello everyone,

I have a php script which import contents objects.

My front website uses ezfind to fetch every contents but imported contents doesn't shows up even after running all possibles ezfind cronjobs and scripts :

- php runcronjobs -s mysite (ezfindexcontent|ezfoptimizeindex)

- php extension/ezfind/bin/php/updatesearchindexsolr.php -s

- php extension/ezfind/bin/php/ezsolroptimize.php -s

Is there something special to do ?

What is strange is that contents get indexed if i republish the object via admin siteaccess...

Any help would be appreciated !

EZP is Great

Matthieu Sévère

Tuesday 21 September 2010 4:32:50 am

Hi Martin,

Do you get any errors in var/log/error.log ?

Do you run the script php extension/ezfind/bin/php/updatesearchindexsolr.php with your admin siteaccess ?

--
eZ certified developer: http://ez.no/certification/verify/346216

H-Works Agency

Tuesday 21 September 2010 5:10:44 am

Hello,

In fact i have this : [ Sep 21 2010 11:07:51 ] [83.199.84.18] eZSolr::addObject():1502 Unable to fetch main node for object: 588

Gonna correct my import script - thanx !

EZP is Great

Matthieu Sévère

Tuesday 21 September 2010 5:16:45 am

I you're dealing with import you may consider this awesome extension : http://projects.ez.no/sqliimport

Cheers

--
eZ certified developer: http://ez.no/certification/verify/346216

H-Works Agency

Tuesday 21 September 2010 8:52:08 am

Still can't find them using ezfind. damned.

Do i have to use the registerSearchObject method after importing something ?

Is it ok to use "createAndPublishObject" method in 4.2 copied from 4.3 ?

Please help :(((

Thanx

EZP is Great

Carlos Revillo

Tuesday 21 September 2010 12:49:21 pm

Hi Martin.

Recently i have into the same issue. not usign createAndPublishObject though, but that shouldn' t be the problem.

in my case, the problem was that my content objects has some ezdate attributes, but i was not filling those attribs with any value. so, i was sending empty values to solr for those attrs and solr failed indexing those objects...

could this be the case?

the issue is reported and fixed by Paul at http://issues.ez.no/IssueView.php?Id=16365&activeItem=6

hope it helps.

H-Works Agency

Wednesday 22 September 2010 3:53:01 am

Hello Carlos,

Thank you for the tip it can be the case here as my content class has multiple ezdate attributes and they are not mandatory. I am gonna try to fill those in to see what happens.

What i don't understand with ezfind is that it doesn't seems necessary to run indexation cronjobs, in fact when i publish content via the admin siteaccess objects are indexed even without cronjobs.

Does anybody know what those cronjobs are made for ?

EZP is Great

H-Works Agency

Wednesday 22 September 2010 10:01:51 am

You were right carlos thanx a lot !

After filling every date field ezfind indexes contents.

I hope this will be corrected because its a real problem though.

EZP is Great

Sebastiaan van der Vliet

Wednesday 22 September 2010 11:30:18 am

Some other datatypes might give you the same problem. In the function addDocs in eZ find, ezsolrbase.php, check the string $updateResult. Solr will tell you there what the problem is.

As a solution, instead of filling al the date fields, you can also change the configuration in schema.xml, turning the date field into a text field within the dynamic field definitions, e.g:

<field name="exm_dateemploy_dt" type="text" indexed="true" stored="true" multiValued="true"/>

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

H-Works Agency

Tuesday 05 October 2010 10:28:45 am

Hi,

Thanx a lot for this. I am running into multiple problems trying to run ezfind in production sites....usually small details making everything fall apart.

After content import i have a lot of warning and content indexation problems :

   
Undefined offset: 36760 in /$home/ezpublish-4.3.0_dev/extension/ezfind/search/plugins/ezsolr/ezsolr.php on line 814
Notice: PHP: E_NOTICE Oct 05 2010 19:26:02
Undefined property: eZContentObject::$ClassID in /$home/ezpublish-4.3.0_dev/kernel/classes/ezpersistentobject.php on line 1224

Ending with hundreds of warning in my debug.

EZP is Great