Exclude certain content types from search, BUT allow search to find them in views?
overtune - June 30, 2009 - 11:51
Hi!
I have a site, where I use apache-solr to search and index the content.
I have certain content types, for example "FAQ". Which contains a textfield for a question and a textfield for an answer.
These faq:s is listed in an faq page, using a view.
When I search the site the search finds faq content, but links them to their node-path.
I want it to link to the faq-page, where all questions is listed.
Is there some way to exclude the content type "faq", but still allow the solr-search to index content from views?
Or can I do some kind of redirect from the individual faq-nodes to the main faq-page?
Thanks in advance!

I am sure there would be
I am sure there would be someone out there who has done this, but it aint me ;).
However I imagine this could be achieved in two steps:
Exclude content from search
You could exclude the content type from the search indexing. Check out http://www.lullabot.com/articles/hiding-content-drupals-search-system (there are some other methods of doing this discussed on the forums)
Index your view output
You could create a custom module that uses hook_update_index to add the view content to the search system for indexing
http://api.drupal.org/api/function/hook_update_index/6
Doesn't sound so hard...
Hi! Thanks for your
Hi!
Thanks for your reply!
But I doesn''t use drupals search, I use apache solr, with the apache solr module.
With apache solr module it's really easy to exclude certain contenttype from indexing.
But, the things is, I don't want the search to link to the nodes of the faq-contenttype's content.
E.g:
SEARCH RESULT
1. How do I?.... -> Links to: http://mysite.com/node/123
2. How to?.... -> Links to: http://mysite.com/node/167
3. What about? -> Links to: http://mysite.com/node/45
I would instead want this:
1. How do I?.... -> Links to: http://mysite.com/faq
2. How to?.... -> Links to: http://mysite.com/faq
3. What about? -> Links to: http://mysite.com/faq
So the page http://mysite.com/faq contains a view that lists all nodes of the faq-contenttype.
How do i prevent the node themself to be indexed, and instead indexing the page http://mysite.com/faq, with the vews output included?
Another way would be to
Another way would be to intercept the menu path. check out hook_menu_alter - implement it in a module and then intercept the node path. If the node is an faq content type you can push it to your view, otherwise push it through to the node menu callback.
That way you don't have to change any indexing for search or any paths, it all happens at the controller level.
http://api.drupal.org/api/function/hook_menu_alter/6
Probably got an answer or
Probably got an answer or given up this for now:
One way of doing it is insert the view into a node somehow; panel node? may do it, as well as views_attach and any of the insert_view or other 'insert so and so view into node' modules where the view is actually inserted into a node content, so search indexes it, as a node then exclude faq item from the search index.
Personally I want a 'redirect content type, node, etc. to other path'