Project

General

Profile

« Previous | Next » 

Revision b3d49e6e

Added by Andreas Kohlbecker over 7 years ago

ref #4223 lucene based taxon search always as phrase search

View differences:

modules/cdm_dataportal/cdm_dataportal.search.php
499 499
 *    ignored (parameter value = 'IGNORE')
500 500
 *  - and more
501 501
 *
502
 *
502
 * @param $search_endpoint string
503
 *    The web service endpoint which will be used for executing the search.
504
 *    Usually one of CDM_WS_PORTAL_TAXON_SEARCH, CDM_WS_PORTAL_TAXON_FIND,
505
 *    CDM_WS_PORTAL_TAXON_FINDBY_DESCRIPTIONELEMENT_FULLTEXT.
503 506
 * @return array
504 507
 *   the processed request parameters submitted by the search form and
505 508
 *   also stores them in $_SESSION['cdm']['search']
506 509
 */
507
function cdm_dataportal_search_request()
510
function cdm_dataportal_search_request($search_endpoint)
508 511
{
509 512

  
510 513
  $form_params = array();
......
519 522

  
520 523
  $form_params['query'] = trim($_REQUEST['query']);
521 524

  
525
  if($search_endpoint == CDM_WS_PORTAL_TAXON_SEARCH){
526
    // lucene based taxon search always as phrase search: enclose it in "
527
    if(!str_beginsWith($form_params['query'], '"')){
528
      $form_params['query'] = '"' . $form_params['query'];
529
    }
530
    if(!str_endsWith($form_params['query'], '"')){
531
      $form_params['query'] = $form_params['query'] . '"' ;
532
    }
533
  }
534

  
522 535
  // --- handle geographic range
523 536
  // Split of geographic range.
524 537
  unset($form_params['areas']);
......
639 652

  
640 653
  // Read the query parameters from $_REQUEST and add additional query
641 654
  // parameters if necessary.
642
  $request_params = cdm_dataportal_search_request();
655
  $request_params = cdm_dataportal_search_request($_REQUEST['ws']);
643 656

  
644 657
  $taxon_pager = cdm_ws_get($_REQUEST['ws'], NULL, queryString($request_params));
645 658

  

Also available in: Unified diff