Hi,
I'm pretty new to Ruby and Radiant so please be gentle. I've
installed the Sphinx Search extension for a site search facility. I
need the search to include several other content models, such as
NewsArticles, and not just Pages.
I've so far added this to the env ironment.rb
config.after_initialize do
ThinkingSphinx::Configuration.instance.model_directories << "#
{RAILS_ROOT}/vendor/extensions/news/app/models/"
# Add new inflection rules using the following format:
ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable 'config'
end
end
This works fine as all the news gets indexed, however I'm struggling
to search the news article. When I do a search terms that has
NewsArticles in it I get the following error message
undefined method `request' for #<NewsArticle:0x1064e3a48>
I've had a hunt around the code, but can't find anything that seems
obvious.
I've so far updated the search_page.rb file as follows (it was only
previously search the Page object):
def process(request, response)
@query = request.params[:query]
# Ensure search is not run with empty term
@results = @query.blank? ? ThinkingSphinx::Search.new
(0,@@per_page,0,0) : ThinkingSphinx.search(@query, :page =>
request.params[:page], :per_page => @@per_page)
super
end
Another thing I've spotted when doing a search with on Page objects in
the results is that the excerpt contains html tags. I know I can
strip the tags quite easily, but does it mean that the tags are being
indexed and as such and class or id attributes etc might appear in
search results?
One final question, there doesn't appear to be a link tag in the
extension's tag class. Do I need to write my own 'link' tag to link
to the correct page?
thanks
John
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant