First off, great module! I'm working on a project for a client and we needed an easy way to control the search results based on Content-type. Using Views was a good start, but didn't allow enough granularity for defining different views based on the content type selected (in the Guided Search).

I've attached a patch file in hopes that this can be committed to a future version of the code. I realize that the approach I had to use is not as elegant as if I had the content-type value to work with directly (and so had to resort to some substr hacks to get that info), but I hope my code gets us in the right direction to offering a more flexible integration with Views.

For anyone wishing to apply this patch, you should note the following:

1.) You will need to define a "generic view" which will handle all search results (if no content-type or a non-matching content-type is selected).

2.) Make sure you select that "generic view" in Administer > Site configuration > Faceted search > (Environment) > Results page > Display style dropdown.

3.) Next, you can create your custom views appropriate to the particular content-type by creating a new view (make sure you include the Environment ID as instructed in the module's documentation). Name the new view 'faceted_search_results_content-type' where 'content-type' is the name of your content type you wish to customize. (e.g. if you want to override the 'blog' results, create your view called 'faceted_search_results_blog')

4.) That's it! Go run a search by keyword, and using the guided to either filter your results, or start with guided and filter down. This works in any manner of search, with multiple/single word strings, using guided either before or after the search.

Please share your input (and David I'd appreciate your input on cleaning up those substr lines - I realize there should be a better approach).

Thank you again,
dellintosh

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dellintosh’s picture

sorry about that... wrong version of the patch. Try this one instead.

dellintosh’s picture

Replaced ereg() with strstr() for better performance. :)

David Lesieur’s picture

Title: Allow content_type specific Views integration » Configurable results display style depending on search criteria
Status: Needs review » Needs work

Very interesting. I sure do see this being useful in many cases.

I guess we need some kind of generic way to select the results display style according to the search criteria.

The Use the Extracts display style selectively option that's currently provided in Faceted Search is another example of a not-so-generic way of changing the display style depending on the current search.

We needs to think a little bit more about this... I feel the patch is a bit too specific (as is the Use the Extracts display style selectively feature) and the particular configuration it needs not so intuitive to setup.

dellintosh’s picture

David,

Thank you for taking time to look at my patch. :) This particular requirement was set up to meet a client need, but I believe that moving to a more flexible output system would be much better than my patch; so I'm all for further discussion if you'd like.

If I take my concept a bit further, I can see an option within the FS administration that allows for selecting the view to display search results via a dropdown. Obviously the requirement for a different view for each content-type makes this a bit trickier, so perhaps it can be an option on the edit form for the environment. Either that, or take an approach like CCK uses, with a separate tab to manage the content-types being searched. On this tab could be listed the various content types that you've set up in the environment, and a dropdown providing the different views available for displaying those results.

Something like:

Guided Search | Use View for Results
story | [dropdown - views available]
blog | [dropdown - views available]

This might be a good size upgrade for the faceted search views integration, but could provide better interface options for displaying the search results. More thoughts?

apaderno’s picture

Status: Needs work » Closed (outdated)

I am closing this issue, as Drupal 5 is now not supported.