Skip to content

Commit

Permalink
Merge pull request #347
Browse files Browse the repository at this point in the history
Add better logic for search
  • Loading branch information
portableant authored May 14, 2022
2 parents e679c74 + 3d09c5e commit a20d0f0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
61 changes: 38 additions & 23 deletions app/SolrImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,45 +58,60 @@ public function import(array $data, string $contentType, string $table, string $
$doc->thumbnail = $record[$image]['data']['thumbnails'][5]['url'];
$doc->image = $record[$image]['data']['full_url'];
$doc->smallimage = $record[$image]['data']['thumbnails'][4]['url'];
$doc->searchImage = $record[$image]['data']['thumbnails'][2]['url'];
$doc->searchImage = $record[$image]['data']['thumbnails'][13]['url'];
}
}
if (Arr::exists( $record, 'section')) {
if(Arr::accessible($record['section'])) {
// Section
if (Arr::exists($record, 'section')) {
if (Arr::accessible($record['section'])) {
$doc->section = $record['section'];
}
}
if (Arr::exists($record,'keystages' )) {
if(Arr::accessible($record['keystages'])) {
$doc->keystages = implode(',', $record['keystages']);
// Key stage for learning activities
if (Arr::exists($record, 'keystages')) {
if (Arr::accessible($record['keystages'])) {
$doc->keystages = implode(',', array_filter($record['keystages']));
}
}
if (Arr::exists($record,'key_stages')) {
if(Arr::accessible($record['key_stages'])) {
$doc->keystages = implode(',', $record['key_stages']);
}
// Single keystage entry
if (Arr::exists($record, 'key_stage')) {
$doc->key_stage = $record['key_stage'];
}
// Session type - learning files type
if (Arr::exists($record, 'type')) {
$doc->type = $record['type'];
}
if (Arr::exists($record,'session_type')) {
if(Arr::accessible($record['session_type'])) {
$doc->session_type = implode(',', $record['session_type']);
// Type of activities school sessions -array
if (Arr::exists($record, 'type_of_activity')) {
if (Arr::accessible($record['type_of_activity'])) {
$doc->type_of_activity = implode(',',array_filter($record['type_of_activity']));
}
}
if (Arr::exists($record,'type_of_activity')) {
if(Arr::accessible($record['type_of_activity'])) {
$doc->type_of_activity = $record['type_of_activity'];
// Type of activities school sessions - array
if (Arr::exists($record, 'session_type')) {
if (Arr::accessible($record['session_type'])) {
$doc->session_types = implode(',',array_filter($record['session_type']));
}
}
if (Arr::exists($record,'type')) {
if(Arr::accessible($record['type'])) {
$doc->type_of_activity = $record['type'];
// School sessions curriculum link - array of values
if (Arr::exists($record, 'curriculum_link')) {
if (Arr::accessible($record['curriculum_link'])) {
$doc->curriculum_link = implode(',',array_filter($record['curriculum_link']));
}
}
if (Arr::exists($record,'curriculum_area')) {
if(Arr::accessible($record['curriculum_area'])) {
$doc->curriculum_link = implode(',', $record['curriculum_area']);
// School sessions theme - array of values
if (Arr::exists($record, 'theme')) {
if (Arr::accessible($record['theme'])) {
$doc->themes = implode(',',array_filter($record['theme']));
}
}
if (Arr::exists($mapping,'file')) {
// Learning files curriculum area - string
if (Arr::exists($record, 'curriculum_area')) {
$doc->curriculum_area = $record['curriculum_area'];
}

// Attached files - array
if (Arr::exists($mapping, 'file')) {
$doc->url = $record[$mapping['file']]['data']['url'];
$doc->mimetype = $record[$mapping['file']]['type'];
$doc->filesize = $record[$mapping['file']]['filesize'];
Expand Down
8 changes: 3 additions & 5 deletions resources/views/components/solr-card.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
<div class="card card-fitz h-100">
@if(!is_null($result['smallimage']))
<a href="{{ $result['url'][0] }}" class="stretched-link">
<div class="ratio ratio-4x3">
<img src="{{ $result['smallimage'][0]}}" alt="Highlight image for {{ $result['title'][0] }}"
loading="lazy"/>
</div>
loading="lazy" class="card-img-top"/>
</a>
@else
<img class="ratio ratio-4x3"
src="https://content.fitz.ms/fitz-website/assets/gallery3_roof.jpg?key=directus-large-crop"
<img class="card-img-top"
src="https://content.fitz.ms/fitz-website/assets/gallery3_roof.jpg?key=exhibition"
alt="A stand in image for {{ $result['title'][0] }}"
loading="lazy"
/>
Expand Down

0 comments on commit a20d0f0

Please sign in to comment.