0

I'm trying to build a advanced search for a eRecruiting site build with the recruiter distribution. The Recruiter Distribution comes with 3 different search two for applicant that are What ? (Job Search) and Where (Job Location). The another one is to search for applicants. However they are a lot data on the job description and on the applicant that I wanted to used to be more specific .

For instance, the recruiters should be able to search for be able to search for the following items:

  • Keyword
  • Location
  • Specialty
  • Employment type

Currently, I have some facets that helps me to make my search more friendly. But when it comes to search many items (such as locations nationwide) it becomes to crowded.

I'm aiming for something similar to Google Advanced Search but a little bit more simpler.

According to a post Building an advanced multicriteria search one the solution to complete this job is the search api solr module. And I have this part working however he did not explain how to do it. There is another post (Create advanced search) that talks very similar of what I'm asking but nobody replay.

I try to use the Search API Combined module but to be honest is lack of documentation. And it does seem to be clear how to used this module.

What is the best approach to created an Advanced Search (multicriteria search) with search api solr ?

2 Answers 2

1

I built a form like this for a website. If I wanted to I'm pretty sure I could use the same principle to build a form like Google Advanced Search. Whether it's the best approach or not I'm not sure.

Which sits on the front page of the websites and then sends to the search page from there.

What I'm doing is recreating the URL thats being created on the search page. like 'search/applications?f[0]=field_location%3A2439'

  • I created a Custom Module

  • used hook_block_info to create a block

  • used hook_block_view to create a block view - assigned the form to its content

  • Example of the form code ->

    function search_applications_form($form, &$form_state) {
    $locations = db_query("SELECT tid, name FROM {taxonomy_term_data} WHERE vid     = 5")->fetchAllKeyed();  // vid will be the id of the location taxonomy data
    
    $form['locations'] = array(
       "#type" => "select",
       '#multiple' => TRUE,
       "#title" => t(""),
       '#required' => FALSE,
       '#default_value' => 'Select Application Locations',
       '#options' => $locations,
       );
     return $form;
     }
    

And in the submit

function search_applications_submit($form, &$form_state) {
     global $base_url;


     $search = $form_state['values']['search_applications'];

     $i = 0;

     if($form_state['values']['locations'] != NULL && $form_state['values']['searchlocations'] != '0' && $form_state['values']['locations'] != 'none'){

     $tid = $form_state['values']['locations'];

     $addlocationsearch = '&f['.$i.']=field_job_location%3A'.$tid;
      $i++;
     } 
     else {
     $addlocationsearch = NULL;
     }

     $searchUrl = $base_url.'/search/applications?'.$addlocationsearch;

     $form_state['redirect'] = $searchUrl;
     }

I think the logic used here could be used to make a much better module. If you've a plan for some development I'd be happy to join in a project.

7
  • This looks good but I would rather having a module than creating my own. There should be a module for this (I think) since this should be very common I think. Otherwise I would like to start a project on drupal.org. Jan 7, 2015 at 14:19
  • yeah, I totally agree. If you find one or start one let me know .
    – Deejay
    Jan 7, 2015 at 15:09
  • base on my research they are any module that allows you to do this. Would you be interested on discuss a plan for project for Drupal.org ? If so how can I contact you ? Jan 8, 2015 at 23:53
  • sure. I've not used it before but how about opening a chat stream chat.stackexchange.com . I won't be able to give much time in working hours but will have a think about it over the weekend.
    – Deejay
    Jan 9, 2015 at 8:23
  • Sounds Good, @Delay... Here is the URL - chat.stackexchange.com/rooms/20216/search-api-solr Jan 13, 2015 at 18:38
1

I found a module that allows you to this Search API multi-index search.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.