MESH-Research / humcore

A library-quality repository for sharing, discovering, retrieving, and archiving digital work.
7 stars 3 forks source link

FAST: wrong formatting for subjects (123:Music:topic) in CORE Deposits search page #193

Closed amareshjoshi closed 2 years ago

amareshjoshi commented 2 years ago

Search results in CORE Deposits display a "search summary" for each match found under the section heading: "Search term matches:"

The Subject line in this section is section is displaying incorrectly. e.g.

Search term matches:
Subject
    ... 1030696:Musical analysis:topical ...
Tag
    ... music analysis ...

see attached screenshot:Screenshot from 2022-06-20 16-21-52.png

amareshjoshi commented 2 years ago

This may not be possible from the humcore plugin because all searching is done by calling Solr and Solr has to store the entire subject. The humcore code just send search terms to Solr and Solr send back the results.

In file class-humcore-deposit-search-results.php

class Humcore_Deposit_Search_Results {
// ...
// line 217
$results = $solr_client->get_search_results( $restricted_search_terms, $search_facets, $this->pag_page, $sort, $this->pag_num );

But may need to do some more checking in Solarium (Solr API)

amareshjoshi commented 2 years ago

Or we could just format the matching subject when it is displayed in screens.php: 1073

foreach ( $highlights as $field => $highlight ) {
  //
  // for Subject ONLY we extract the subject from "1234:Music:topic"
  if($field == "Subject"){
    $subject_list = array();
    foreach ( $highlight as $fast_subject ){
      [$id, $subject, $topic] = explode(":", $fast_subject);
      $subject_list[] = $subject;
    }
    $highlight = $subject_list;
  }
    echo '<dt>' . $field . '</dt>';
  echo '<dd>... ' . implode( ' ( ... ) ', $highlight ) . ' ...</dd>';
}
mikethicke commented 2 years ago

@amareshjoshi We can close this right?

amareshjoshi commented 2 years ago

@mikethicke not yet. This is the issue we talked about at yesterday's meeting. I couldn't complete it because Solr is down (so I can't test). Once it's back up I'll finish it off and close it.