2012-02-11, 02:15:53
geroyche Wrote:Thanks for the quick reply.
Sometimes sleep helps. I did some debugging and I realized that the problem lay elsewhere.
The news manager function i used to fetch posts did not even include the content (it fetched everything else from a sort of "cache" News Manager creates).
Everything works now as it should.
Great!
You should post instructions on how to use your code to the news manager support thread.
One more tip: You could pass array('news', $category) as tags to the indexer, where $category is the category of the news item (I think there is one?). Then you can specifically search for news and categories.
geroyche Wrote:I have one more question though: somehow your index is created everytime a regular page is being saved/updated.
The News Manager items are managed separately.
I reckon I might have to patch its code to trigger an index update.
How do I trigger it?
Just call delete_i18n_search_index(). The index is recreated, when the next search is executed.
geroyche Wrote:FYI: here are the functions as they need be for News Manager. Don't know if you want to include them in your plugin, though I figure I should probably give them to the NM dev instead.
http://pastebin.com/eqXS6XAR
I would upload the plugin for the general public, except that when I store it as a separate php file in my plugin folder, I cannot login anymore. I get stuck in a redirect loop.
I already had another custom plugin, and when I just include the functions in that one, everything works,
You should try to have it included in the news manager.
I specifically created this functionality in the Search plugin to allow other plugins to use this global search instead of implementing a search themselves.
I think, if you include a register_plugin call thus making a regular plugin from it, you should have no problems with loops. If you additionally add checks for the News Manager in your function i18n_search_nm_index - if (!function_exists('nm_get_posts')) return; - your plugin won't crash even if News Manager is not installed.
This shows that it's easy to not only extend GetSimple with plugins, but also to extend plugins themselves.