Tuesday, November 2, 2010

How to: Add targeted research to your Drupal site

Connecting the movie (right-click to download) problem with this video? Contact me

When it comes to search, Drupal seems to do OK for itself.However, there are a number of modules that will make even better default search engine of Drupal, the supportive. These include Porter-Stemmer (English only), 404 Research, paged search, alike in terms and many others.

If you're seekign to help a superuser out, then modules as Search config can help with that. but what about the user which does not dare go into hidden region of ' advanced search '? This is where the power is-right?

It is safe. This is where you tell what categories and kinds of content you want to limit your search to Drupal.This is where a user, simply looking for a job on your site that lists information on jobs, news, blogs and other items, can focus their results.

So, why not stop the user to figure this out and just waiting for this to happen for them! this is what this video is all about.Using the search box the default Drupal and forcing him to focus on specific content types or categories. to check what search Drupal and you control where it shows up!

Search related forms

The project Apache Solr is what is used on drupal.org.sai, where we get the results faceted cool from a search request.

Of course, if you haven't already heard of it, the search service Acquia make it fairly easy to exploit the coolness Apache Solr.

Here is the code.
<>
//All the following code goes inside template.php

/*
* Using one of the preprocessing ami in template.php, you create a
* variable that you call the function that creates drupal_get_form
* the search form
*/
theme function-name-HERE _ preprocess_node (& $ vars, $ hook) {}
$ vars [' focused_search '] = drupal_get_form (' THEME-NAME-HERE _ focused_search_form ');
}

/*
* This function will create a search form that adds a validator
* the manager that you use to append your own search criteria
* Note to self: form of context could be used here?
*/
theme function-name-HERE _ focused_search_form (& $ form_state, $ keys = '') {}
//Render the form below to search for a type of targeted content
If (module_exists (' search ')) {}
$ module = search_form ($ form_state, '/'. drupal_get_path_alias ($ _GET [' q ']));//Use existing code search engine
$ form [' # validate '] = array (' search_form_validate ', ' HERE_focused_search_validate-NAME-theme ');
$ form [' # send '] = array (' search_form_submit ');
Return $ form;
}
}

/*
* Added validation Manager within the search form is where do
* adjustments to research managed by Drupal. you can use any
* 5. desired criteria, including the path or other available variables
* within Drupal.
*/
theme function-name-HERE _ focused_search_validate ($ form, & $ form_state) {}
//Using a matrix to determine what type of content location based search from the search form
$ content_type = array_search ($ form [' # action '], array ()
' vendor_item ' = > '/suppliers,
' job_item ' = > '/processes/sites ',
)
);
$ content_type = empty ($ content_type)? '': $ content_type;
//Initialize using any keyword research existing base.
//taken by function node_search_validate module () node.
$ keys = $ form_state [' values '] [' processed_keys '];
$ keys = search_query_insert ($ key, ' type ', $ content_type);//additional search criteria added here
form_set_value ($ form [' base '] [' inline '] [' processed_keys '], $ form_state, trim ($ keys));
}
?>


View the original article here

No comments:

Post a Comment