Page 1 of 1
Reindex All Content!
Posted: Tue Feb 22, 2011 9:21 pm
by kierweb
I am writing a php script which will be run by cron to parse the text from pdf and doc files within the uploads module and place that information into the description therefore allowing users to search the contents of the files.
The php script is working correctly, but I am having to manually reindex the search keywords by going into the admin pages / search.
Does anyone know how I access the reindex function (which i notice is in modules/search/search.tools.php) from within my php script, therefore making it fully automated.
Thanks
Darren
Re: Reindex All Content!
Posted: Tue Feb 22, 2011 9:44 pm
by calguy1000
The Search module has an AddWords method.
Re: Reindex All Content!
Posted: Tue Feb 22, 2011 11:15 pm
by kierweb
How do I access these functions?
Currently the PHP script is seperate from the CMS functions and accesses the database direct.
Darren
Re: Reindex All Content!
Posted: Tue Feb 22, 2011 11:23 pm
by Jos
kierweb wrote:How do I access these functions?
You can take the addarticle.php from the news module as an example:
http://viewsvn.cmsmadesimple.org/filede ... rticle.php
kierweb wrote:Currently the PHP script is seperate from the CMS functions and accesses the database direct.
Then I guess it won't be possible to use the cmsms functions
Re: Reindex All Content!
Posted: Thu Feb 24, 2011 3:01 am
by replytomk3
kierweb wrote:I am writing a php script which will be run by cron to parse the text from pdf and doc files within the uploads module and place that information into the description therefore allowing users to search the contents of the files.
Will this most interesting module be released to the public?
Re: Reindex All Content!
Posted: Wed Mar 02, 2011 10:36 pm
by kierweb
I've got the command i needed to automate the reindex which was ...
Code: Select all
$gCms->modules['Search']['object']->Reindex();
One more little problem to iron out - which is some pdf files are not parsing the text correctly - but once thats fixed, I will probrably package it up and release it.
I will point out its not actually a module - its one php file which you would need to set up a cron job to run at regular intervals.
Re: Reindex All Content!
Posted: Thu Mar 03, 2011 1:58 am
by Dr.CSS
That would be considered a plugin/tag and CMSMS has cron in the admin, site admin section...
Re: Reindex All Content!
Posted: Thu Mar 03, 2011 9:43 am
by kierweb
On the site I have coded this on, the reindex routine seems to down the site while its doing it ... and the reindex can take about 10 minutes. So I have set the cron job to run it at 2am in the morning, when no one will be viewing it.