diff --git a/build.xml b/build.xml index 05465ff127d..3133c588eff 100644 --- a/build.xml +++ b/build.xml @@ -654,6 +654,7 @@ + @@ -941,6 +942,20 @@ return [ + + + + + + + + + + + + + + diff --git a/import/raw.properties b/import/raw.properties new file mode 100644 index 00000000000..644e8e2a3b7 --- /dev/null +++ b/import/raw.properties @@ -0,0 +1,9 @@ +; XSLT Import Settings for passing raw XML through to Solr +[General] +; REQUIRED: Name of XSLT file to apply. Path is relative to the import/xsl directory +; of the VuFind installation (or your local override directory). +xslt = raw.xsl + +; XSLT parameters -- any key/value pairs set here will be passed as parameters to +; the XSLT file, allowing local values to be set without modifying XSLT code. +[Parameters] diff --git a/import/xsl/raw.xsl b/import/xsl/raw.xsl new file mode 100644 index 00000000000..d191055c958 --- /dev/null +++ b/import/xsl/raw.xsl @@ -0,0 +1,5 @@ + + + + + diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/WebSearchTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/WebSearchTest.php new file mode 100644 index 00000000000..c4202d34609 --- /dev/null +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/WebSearchTest.php @@ -0,0 +1,106 @@ + + * @author Ere Maijala + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ + +namespace VuFindTest\Mink; + +use function intval; + +/** + * Mink web search test class. + * + * @category VuFind + * @package Tests + * @author Demian Katz + * @author Ere Maijala + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ +class WebSearchTest extends \VuFindTest\Integration\MinkTestCase +{ + /** + * Data provider for testWebSearch() + * + * @return array[] + */ + public static function webSearchProvider(): array + { + return [ + 'blank search' => ['', 3, '', ['Fact', 'Fantasy', 'Fiction']], + 'search in full text' => ['"second record"', 1, 'second record', ['Fact']], + 'search in description' => ['three', 1, 'three', ['Fantasy']], + ]; + } + + /** + * Test performing a Web search + * + * @param string $query Search query + * @param int $expectedCount Expected search result count + * @param string $expectedFirstHighlight Expected first highlighted text on page + * @param string[] $expectedSubjectFacets Expected subject facet values + * + * @return void + * + * @dataProvider webSearchProvider + */ + public function testWebSearch( + string $query, + int $expectedCount, + string $expectedFirstHighlight, + array $expectedSubjectFacets + ): void { + // Perform the search: + $session = $this->getMinkSession(); + $session->visit($this->getVuFindUrl() . '/Web'); + $page = $session->getPage(); + $this->findCssAndSetValue($page, '#searchForm_lookfor', $query); + $this->findCss($page, '.btn-primary')->click(); + $this->waitForPageLoad($page); + + // Confirm the result count: + $this->assertEquals( + $expectedCount, + intval($this->findCssAndGetText($page, '.js-search-stats strong', index: 1)) + ); + + // Confirm highlighting: + if ($expectedFirstHighlight) { + $this->assertEquals($expectedFirstHighlight, $this->findCssAndGetText($page, '#result0 mark')); + } + + // Confirm facet values: + $subjectText = []; + $subjects = $page->findAll('css', '#side-panel-subject .facet-value'); + foreach ($subjects as $subject) { + $subjectText[] = $subject->getText(); + } + $this->assertEquals($expectedSubjectFacets, $subjectText); + } +} diff --git a/tests/data/website/solr.xml b/tests/data/website/solr.xml new file mode 100644 index 00000000000..06fd8a069be --- /dev/null +++ b/tests/data/website/solr.xml @@ -0,0 +1,35 @@ + + + 001 + This is the content of the first record. + This is the description of record number one. + one first + First Web Page + http://localhost/1 + Test Pages + Fake Link + Fiction + + + 002 + This is the content of the second record. + This is the description of record number two. + two second + Second Web Page + http://localhost/2 + Test Pages + Fake Link + Fact + + + 003 + This is the content of the third record. + This is the description of record number three. + three third + Third Web Page + http://localhost/3 + Test Pages + Fake Link + Fantasy + +