+ + {{ $document->title_output }} + +
++ Abstract: {{ $document->abstract_output }} +
+diff --git a/app/Http/Controllers/Frontend/SearchController.php b/app/Http/Controllers/Frontend/SearchController.php index 58655a9..2b45573 100644 --- a/app/Http/Controllers/Frontend/SearchController.php +++ b/app/Http/Controllers/Frontend/SearchController.php @@ -101,6 +101,12 @@ class SearchController extends Controller public function index(): View { $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')); } diff --git a/app/Http/Controllers/Frontend/SolariumController.php b/app/Http/Controllers/Frontend/SolariumController.php new file mode 100644 index 0000000..14ef8d7 --- /dev/null +++ b/app/Http/Controllers/Frontend/SolariumController.php @@ -0,0 +1,89 @@ +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 . '
id | ' . $document->id . ' |
---|---|
title | ' . $document->title_output . ' |
abstract | ' . $document->abstract_output . ' |
Data Archival
RDR provides format-independent archiving services for data protection. @@ -35,6 +36,7 @@
Your search yielded {{ $resultset->getNumFound() }} results:
++ Abstract: {{ $document->abstract_output }} +
+