Apache Solr - Drupal

 

Thank you for attending my session.  You can get the slides here: https://drive.google.com/file/d/0B668pst_pr6WbUFseC1malE4ODA/view?usp=sh...

Bellow you will find useful links for tools and modules covered in Drupal and Solr Search: A Powerful Marrige session.

Apache Solr

https://archive.apache.org/dist/lucene/solr/4.10.2/solr-4.10.2.tgz

Tika (for indexing PDF/DOC...)

http://archive.apache.org/dist/tika/tika-app-1.5.jar

Drupal Modules

 
Style Search Results Google like template
Save the code as search-result.tpl.php and save inside your theme/templates folder. Clear cache and check out your new styled results. 
 
<?php
global $base_url;
$nd = str_replace($base_url.'/','',$url);
$path =  drupal_get_normal_path($nd);
$pp = explode('/', $path);
if (isset($pp[1]) && is_numeric($pp[1]) ){
  $node = node_load($pp[1]);
  if ($node->type == 'tax_form'){
    if (isset($node->field_tax_file['und'][0]['uri'])){
      $url = file_create_url($node->field_tax_file['und'][0]['uri']);
    }
    if (isset($node->field_year2['und'][0]['value'])){
      $year = substr($node->field_year2['und'][0]['value'], 0, 4).' ';    
    }else {
      $year = '';
    }
    $snippet = $year.'Year-End Tax Reporting Data - '. $node->title;    
  }
}
?>
<li class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php print render($title_prefix); ?>
  <h3 class="title"<?php print $title_attributes; ?>>
    <a href="<?php print $url; ?>"><?php print $title; ?></a>
  </h3>
  <?php print render($title_suffix); ?>
  <div class="search-snippet-info">
    <?php if ($snippet): ?>
      <p class="search-snippet"<?php print $content_attributes; ?>><?php print $snippet; ?></p>
    <?php endif; ?>
      
      <div>
        <?php print l($url, $url) ; ?>
      </div>
    
    </div>
</li>
 
Add this to your css: 
 
<style>
  .search-result{
    padding-bottom: 12px;
    border-bottom: 1px solid #e8e8e8;
  } 
</style>
 

Latest News

June 20, 2017

The premier Washington DC Drupal web development conference is happening soon! New Target is pleased to sponsor the conference once again as a...Read more

June 9, 2017

Community of Hope is based in Washington, D.C. and provides services to homeless and low-income individuals and families, including transitional...Read more

May 24, 2017

Had a bad website experience?  Can’t find what you need on a website? Sending off an email through a web form or clicking to chat can...Read more

Work With Us

New fieldset
New fieldset
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
815 North Royal Street
Suites 100 & 204
Alexandria, Virginia 22314

703.548.3433 (Office)
703.548.5032 (Fax)

web@newtarget.com