Monday 23 April 2012 9:39:54 am - 3 replies
Hi.
I wrote my own import script to store data from csv into ez using a nightly cronjob. Imported data is about 15000 objects. Now I had to change a row manually, so I used the internal search function to get the requested row but NO result was found.
I made some tests with a random imported object and found out that ez seach function is only able to find the imported objects after they are re-edited and published via admin backend.
Here is my import script, hopefully there is someone who can help me finding a solution for my problem.
$params = array(); // set class identifier $params['class_identifier'] = 'my_class'; //using the admin-user $params['creator_id'] = 14; //pulling the node id out of the parent $params['parent_node_id'] = some_node_id; $params['section_id'] = some_section_id; //setting attribute values $attributesData = array() ; // setup class attributes $attributesData['name'] = 'my new object'; $attributesData['link_title'] = 'new object'; $attributesData['...'] = '...'; $params['attributes'] = $attributesData; //publishing the content: $contentObject = eZContentFunctions::createAndPublishObject( $params );
Thanks for your help.
Philip
Monday 23 April 2012 10:13:52 am
Hi Philip,
I guess your content objects aren't indexed in search engine.
You can do it by this way :
add an entry in ezpending_action table (object_id, timestamp creation, action), action have to be "index_object", then run indexcontent.php cron
You can also add the cron's code to your import script :
eZSearch::removeObject( $object );
eZSearch::addObject( $object );
Regards
Modified on Monday 23 April 2012 10:14:46 am by Remy MOURARD
Monday 23 April 2012 12:29:09 pm
Hi Philip,
you can also use:
$contentObject = eZContentFunctions::createAndPublishObject( $params ); eZContentOperationCollection::registerSearchObject( $contentObject->attribute( 'id' ), $contentObject->attribute( 'current_version' ) );
which will make sure that the indexing happens as defined in site.ini (with delayed indexing on or off)
EDIT: Remove html tags from copy/paste
Modified on Monday 23 April 2012 1:20:36 pm by Edi Modrić
You must be logged in to post messages in this topic!