Remove content types from search result

If you are looking for a way to hide specific content types from the core Drupal search result then checkout the Search config module. It’s a good idea to use this module if you are using the Content profile module so you can hide the profile node from appearing in your search result.

It does offer other functionality, but I’ll just show you how to hide a content type from the search result. To install this module just go to the Search config project page and download the module. Unzip the module into sites/all/modules directory. Then login with your administration account and enable the module.

Continue reading “Remove content types from search result”

Creating custom filters in views 2

A project that I’m currently working on requires a classifieds system which is fairly straight forward to setup. I’m using the location module for users to specify a location of the classified. To make the search easy I created a simple views page with exposed filters, but I wanted to have a select field with only Australian states.

Continue reading “Creating custom filters in views 2”

Change select options within a nodereference

First you’ll have to make use of hook_form_alter() function.

function example_form_alter(&$form, $form_state, $form_id) {
  $form['field_example_reference']['#pre_render'] = array('example_change_node_reference');
}

Now the node reference will look for a example_change_node_reference() function which will return an array of options.

function example_change_node_reference($element) {
      $element['nid']['nid']['#options'] = array($node->;nid => $node->title);
  return $element;
 
}

Make sure you pass the $element variable into the function. More info:http://drupal.org/node/339730.

Add alternative search with the Lucene API module

The Search Lucene API module is an alternative search module which can be used on your Drupal site. It’s powered by a stripped down version of the Zend Lucene Search which is a PHP port of Apache Lucene. Because it’s all PHP do don’t have to worry about running the search on a separate server or setup other applications to run the search. To install Search Lucene API go tohttp://drupal.org/project/luceneapi and download the module. Unzip the module into “sites/all/modules”.

The module also requires a stripped down version of the Zend Lucene Search which you’ll have to download separately.

Continue reading “Add alternative search with the Lucene API module”