- new SearchController
- new subtitle in hero section - MimetypeTableSeeder with geo-Package
This commit is contained in:
parent
54d6c5d434
commit
7bf0337faf
|
@ -101,6 +101,12 @@ class SearchController extends Controller
|
||||||
public function index(): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
$totalNumOfDocs = Dataset::count();
|
$totalNumOfDocs = Dataset::count();
|
||||||
|
// get a select query instance
|
||||||
|
$query = $this->client->createQuery($this->client::QUERY_SELECT);
|
||||||
|
// this executes the query and returns the result
|
||||||
|
$resultset = $this->client->execute($query);
|
||||||
|
// // display the total number of documents found by solr
|
||||||
|
$totalNumOfDocs = $resultset->getNumFound();
|
||||||
return view('frontend.solrsearch.index', compact('totalNumOfDocs'));
|
return view('frontend.solrsearch.index', compact('totalNumOfDocs'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
89
app/Http/Controllers/Frontend/SolariumController.php
Normal file
89
app/Http/Controllers/Frontend/SolariumController.php
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Frontend;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use Illuminate\Support\Facades\Input;
|
||||||
|
|
||||||
|
class SolariumController extends Controller
|
||||||
|
{
|
||||||
|
protected $client;
|
||||||
|
|
||||||
|
public function __construct(\Solarium\Client $client)
|
||||||
|
{
|
||||||
|
$this->client = $client;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays simple search form.
|
||||||
|
*/
|
||||||
|
public function index(Request $request): View
|
||||||
|
{
|
||||||
|
if (Input::has('q')) {
|
||||||
|
// Create a search query
|
||||||
|
$query = $this->client->createSelect();
|
||||||
|
|
||||||
|
// Set the query string
|
||||||
|
if (Input::get('q') != "") {
|
||||||
|
$query->setQuery('%P1%', array(Input::get('q')));
|
||||||
|
} else {
|
||||||
|
$query = $this->client->createQuery($this->client::QUERY_SELECT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute the query and return the result
|
||||||
|
$resultset = $this->client->select($query);
|
||||||
|
|
||||||
|
// Pass the resultset to the view and return.
|
||||||
|
return view('frontend.search.index', array(
|
||||||
|
'q' => Input::get('q'),
|
||||||
|
'resultset' => $resultset,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return view('frontend.search.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ping()
|
||||||
|
{
|
||||||
|
// create a ping query
|
||||||
|
$ping = $this->client->createPing();
|
||||||
|
|
||||||
|
// execute the ping query
|
||||||
|
try {
|
||||||
|
$this->client->ping($ping);
|
||||||
|
return response()->json('OK');
|
||||||
|
} catch (\Solarium\Exception $e) {
|
||||||
|
return response()->json('ERROR', 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function search()
|
||||||
|
{
|
||||||
|
$filter = "test"; //$request->input('query');
|
||||||
|
|
||||||
|
// get a select query instance
|
||||||
|
$query = $this->client->createSelect();
|
||||||
|
|
||||||
|
// $query = $this->client->createSelect();
|
||||||
|
$query->setQuery('title:'. $filter);
|
||||||
|
// set a query (all prices starting from 12)
|
||||||
|
// $query->setQuery('price:[12 TO *]');
|
||||||
|
// set start and rows param (comparable to SQL limit) using fluent interface
|
||||||
|
//$query->setStart(2)->setRows(20);
|
||||||
|
|
||||||
|
// this executes the query and returns the result
|
||||||
|
$resultset = $this->client->select($query);
|
||||||
|
// display the total number of documents found by solr
|
||||||
|
$response = 'NumFound: ' . $resultset->getNumFound();
|
||||||
|
// show documents using the resultset iterator
|
||||||
|
foreach ($resultset as $document) {
|
||||||
|
$response = $response . '<hr/><table>';
|
||||||
|
$response = $response . '<tr><th>id</th><td>' . $document->id . '</td></tr>';
|
||||||
|
$response = $response . '<tr><th>title</th><td>' . $document->title_output . '</td></tr>';
|
||||||
|
$response = $response . '<tr><th>abstract</th><td>' . $document->abstract_output . '</td></tr>';
|
||||||
|
$response = $response . '</table>';
|
||||||
|
}
|
||||||
|
echo $response;
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,10 +22,10 @@ class SolariumServiceProvider extends ServiceProvider
|
||||||
$config = array(
|
$config = array(
|
||||||
'endpoint' => array(
|
'endpoint' => array(
|
||||||
'localhost' => array(
|
'localhost' => array(
|
||||||
'host' => '127.0.0.1',
|
'host' => 'repository.geologie.ac.at',
|
||||||
'port' => '8983',
|
'port' => '8983',
|
||||||
'path' => '/solr/',
|
'path' => '/solr/',
|
||||||
'core' => 'opus4'
|
'core' => 'rdr_data'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'endpoint' => [
|
'endpoint' => [
|
||||||
'repository.geologie.ac.at' => [
|
'repository' => [
|
||||||
'host' => env('SOLR_HOST', 'repository.geologie.ac.at'),
|
'host' => env('SOLR_HOST', 'repository.geologie.ac.at'),
|
||||||
'port' => env('SOLR_PORT', '8983'),
|
'port' => env('SOLR_PORT', '8983'),
|
||||||
'path' => env('SOLR_PATH', '/solr/'),
|
'path' => env('SOLR_PATH', '/solr/'),
|
||||||
|
|
|
@ -11,6 +11,13 @@ class MimetypeTableSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|
||||||
DB::table('mime_types')->insert([
|
DB::table('mime_types')->insert([
|
||||||
|
[
|
||||||
|
'name' => 'application/geopackage+sqlite3',
|
||||||
|
'file_extension' => 'gpkg',
|
||||||
|
'enabled' =>true,
|
||||||
|
'created_at' => Carbon::now(),
|
||||||
|
'updated_at' => Carbon::now(),
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'name' => 'image/jpeg',
|
'name' => 'image/jpeg',
|
||||||
'file_extension' => 'jpg|jpeg|jpe',
|
'file_extension' => 'jpg|jpeg|jpe',
|
||||||
|
|
46
public/css/style.css
vendored
46
public/css/style.css
vendored
|
@ -407,9 +407,48 @@ section.normal {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.search-items {
|
||||||
|
list-style: none;
|
||||||
|
width: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.search-items li {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
/* important because we need to overwrite the default skeleton */
|
||||||
|
margin: 0!important;
|
||||||
|
/* width: 33%; */
|
||||||
|
/* border: 10px solid white; */
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
.search-items li:nth-child(4n) {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Work */
|
/* Work */
|
||||||
.work {
|
.work {
|
||||||
background-color: #F5F5F5;
|
/* background-color: #F5F5F5; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Work Filters */
|
/* Work Filters */
|
||||||
|
@ -503,6 +542,11 @@ section.normal {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
|
.work-front .icon {
|
||||||
|
line-height: 1;
|
||||||
|
font-size: 40px;
|
||||||
|
color: #00bfffcc;
|
||||||
|
}
|
||||||
|
|
||||||
.work-items li:hover .work-detail{
|
.work-items li:hover .work-detail{
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 640 KiB |
|
@ -8,7 +8,7 @@
|
||||||
<div class="twelve columns">
|
<div class="twelve columns">
|
||||||
<h1 class="separator">Research Data Repository</h1>
|
<h1 class="separator">Research Data Repository</h1>
|
||||||
<h2>
|
<h2>
|
||||||
Data Publisher for Geo and Atmospheric Science Austria
|
Data Publisher for Geo- and Atmospheric Science Austria
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,6 +53,7 @@
|
||||||
<!-- <img src="images/portfolio/work_1.svg"> -->
|
<!-- <img src="images/portfolio/work_1.svg"> -->
|
||||||
<div class="work-front">
|
<div class="work-front">
|
||||||
<div class="vertical-centered">
|
<div class="vertical-centered">
|
||||||
|
<i class="fa fa-hdd icon" aria-hidden="true"></i>
|
||||||
<h3>Data Archival</h3>
|
<h3>Data Archival</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,6 +70,7 @@
|
||||||
<!-- <img src="images/portfolio/work_2.svg"> -->
|
<!-- <img src="images/portfolio/work_2.svg"> -->
|
||||||
<div class="work-front">
|
<div class="work-front">
|
||||||
<div class="vertical-centered">
|
<div class="vertical-centered">
|
||||||
|
<i class="fas fa-share-alt icon"></i>
|
||||||
<h3>Data Publication</h3>
|
<h3>Data Publication</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,6 +88,7 @@
|
||||||
<!-- <img src="images/portfolio/work_3.svg"> -->
|
<!-- <img src="images/portfolio/work_3.svg"> -->
|
||||||
<div class="work-front">
|
<div class="work-front">
|
||||||
<div class="vertical-centered">
|
<div class="vertical-centered">
|
||||||
|
<i class="fas fa-user-edit icon"></i>
|
||||||
<h3>Peer Review</h3>
|
<h3>Peer Review</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<!-- <img src="images/portfolio/work_1.svg"> -->
|
<!-- <img src="images/portfolio/work_1.svg"> -->
|
||||||
<div class="work-front">
|
<div class="work-front">
|
||||||
<div class="vertical-centered">
|
<div class="vertical-centered">
|
||||||
|
<i class="fa fa-hdd icon" aria-hidden="true"></i>
|
||||||
<h3>Data Archival</h3>
|
<h3>Data Archival</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
<!-- <img src="images/portfolio/work_2.svg"> -->
|
<!-- <img src="images/portfolio/work_2.svg"> -->
|
||||||
<div class="work-front">
|
<div class="work-front">
|
||||||
<div class="vertical-centered">
|
<div class="vertical-centered">
|
||||||
|
<i class="fas fa-share-alt icon"></i>
|
||||||
<h3>Data Publication</h3>
|
<h3>Data Publication</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,6 +54,7 @@
|
||||||
<!-- <img src="images/portfolio/work_3.svg"> -->
|
<!-- <img src="images/portfolio/work_3.svg"> -->
|
||||||
<div class="work-front">
|
<div class="work-front">
|
||||||
<div class="vertical-centered">
|
<div class="vertical-centered">
|
||||||
|
<i class="fas fa-user-edit icon"></i>
|
||||||
<h3>Peer Review</h3>
|
<h3>Peer Review</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
109
resources/views/frontend/search/index.blade.php
Normal file
109
resources/views/frontend/search/index.blade.php
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title', Lang::get('resources.solrsearch_title_simple'))
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<section data-sr id="search" class="search normal u-full-width">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="twelve columns">
|
||||||
|
<h3 class="separator">SEARCH</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="twelve columns">
|
||||||
|
<div class="content">
|
||||||
|
<div class="sidebar-simplesearch">
|
||||||
|
{{ Form::open(array('method' => 'GET')) }}
|
||||||
|
|
||||||
|
{!! Form::text('q', Input::get('q'), array('class'=>'u-full-width',
|
||||||
|
'placeholder'=>'Enter your search term')) !!}
|
||||||
|
<span class="input-group-btn">
|
||||||
|
{{-- {{ Form::submit('Search', array('class' => 'btn btn-primary btn-lg')) }} --}}
|
||||||
|
<button type="submit">
|
||||||
|
<i class="fa fa-search"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
|
{{ Form::close() }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (isset($resultset))
|
||||||
|
<header>
|
||||||
|
<p>Your search yielded <strong>{{ $resultset->getNumFound() }}</strong> results:</p>
|
||||||
|
<hr />
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<ul class="search-items isotope js-isotope u-cf">
|
||||||
|
|
||||||
|
@foreach ($resultset as $document)
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<div class="post">
|
||||||
|
<header class="post-header">
|
||||||
|
<h3 class="post-title">
|
||||||
|
<a href="{{ URL::route('frontend.dataset.show',['id' =>$document->id]) }}">
|
||||||
|
{{ $document->title_output }}
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
</header>
|
||||||
|
<div class="blog-meta">
|
||||||
|
{{ date('D, m M, Y', $document->server_date_modified) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="post-description">
|
||||||
|
|
||||||
|
@if (is_array($document->author))
|
||||||
|
<em>Author: {{ implode(', ', $document->author) }}</em>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<em>Abstract: {{ $document->abstract_output }}</em>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.sidebar-simplesearch {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 2.5em;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-simplesearch input[type=text] {
|
||||||
|
padding: 0.25em 0.3em;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-simplesearch button {
|
||||||
|
padding: 0.25em 0.3em;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
position: absolute;
|
||||||
|
right: 0.25em;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -469,16 +469,21 @@ Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
|
||||||
Route::get('pages/{slug}', 'HomeController@showPage')->name('pages.show');
|
Route::get('pages/{slug}', 'HomeController@showPage')->name('pages.show');
|
||||||
|
|
||||||
//=================================================solr search====================================================
|
//=================================================solr search====================================================
|
||||||
Route::get('/index', [
|
// Route::get('/index', [
|
||||||
'as' => 'search.index', 'uses' => 'SearchController@index',
|
// 'as' => 'search.index', 'uses' => 'SearchController@index',
|
||||||
]);
|
// ]);
|
||||||
Route::post('/queries', [
|
Route::post('/queries', [
|
||||||
'as' => 'queries', 'uses' => 'SearchController@search',
|
'as' => 'queries', 'uses' => 'SearchController@search',
|
||||||
]);
|
]);
|
||||||
Route::get('/queries/', [
|
Route::get('/queries/', [
|
||||||
'as' => 'queries1', 'uses' => 'SearchController@search',
|
'as' => 'queries1', 'uses' => 'SearchController@search',
|
||||||
]);
|
]);
|
||||||
Route::get('/ping', 'SearchController@ping');
|
// Route::get('/ping', 'SearchController@ping');
|
||||||
|
Route::get('/ping', 'SolariumController@ping');
|
||||||
|
// Route::get('/search', 'SolariumController@search');
|
||||||
|
Route::get('/search', [
|
||||||
|
'as' => 'search.index', 'uses' => 'SolariumController@index',
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
//=================================================borrow====================================================
|
//=================================================borrow====================================================
|
||||||
|
|
Loading…
Reference in New Issue
Block a user