41
TYPO3 Find Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf 2018-08-03 10:21

Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 FindRelease 250

Sven-S Porst Ingo Pfennigstorf

2018-08-03 1021

Contents

1 Installation 3

2 Aims 5

3 Basic Example 7

4 Example projects 9

5 TypoScript configuration options 1151 Connection to the Solr index 1152 Solr Components 1253 The search form 1254 Default Display Fields 1555 Default Query 1556 Facets 1557 Sorting 1858 Paging 1859 Excluding documents 19510 Choosing the fields to fetch 19511 Highlighting 20512 Linking to data fields 20513 Jumping to the content 21514 JavaScript and CSS resources 21515 Localisation 22

6 Templating 23

7 Actions 25

8 Data export 27

9 Query String Arguments 2991 Standard arguments 2992 Special arguments 2993 POST arguments 30

10 RealURL 31

i

11 Prerequisites 33

12 Contact 35

13 Acknowledgements 37

ii

TYPO3 Find Release 250

This TYPO3 extension aims to enable the query and display of arbitrary Solr indexes

It provides the ability to configure many aspects of the query ndash eg query fields facets filtering through TypoScriptndash and set up the display through Fluid templates Partials for standard display features as well as a number of ViewHelpers that help creating those templates are included in the extension

Contents 1

TYPO3 Find Release 250

2 Contents

CHAPTER 1

Installation

For developing this extension clone this repository and install the dependencies via composer with composerinstall

3

TYPO3 Find Release 250

4 Chapter 1 Installation

CHAPTER 2

Aims

The extensions aims are to provide

bull access to arbitrary Solr indexes in TYPO3

bull minimal configuration for a basic display

bull rich templating abilities for creating complex displays

5

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 2: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

Contents

1 Installation 3

2 Aims 5

3 Basic Example 7

4 Example projects 9

5 TypoScript configuration options 1151 Connection to the Solr index 1152 Solr Components 1253 The search form 1254 Default Display Fields 1555 Default Query 1556 Facets 1557 Sorting 1858 Paging 1859 Excluding documents 19510 Choosing the fields to fetch 19511 Highlighting 20512 Linking to data fields 20513 Jumping to the content 21514 JavaScript and CSS resources 21515 Localisation 22

6 Templating 23

7 Actions 25

8 Data export 27

9 Query String Arguments 2991 Standard arguments 2992 Special arguments 2993 POST arguments 30

10 RealURL 31

i

11 Prerequisites 33

12 Contact 35

13 Acknowledgements 37

ii

TYPO3 Find Release 250

This TYPO3 extension aims to enable the query and display of arbitrary Solr indexes

It provides the ability to configure many aspects of the query ndash eg query fields facets filtering through TypoScriptndash and set up the display through Fluid templates Partials for standard display features as well as a number of ViewHelpers that help creating those templates are included in the extension

Contents 1

TYPO3 Find Release 250

2 Contents

CHAPTER 1

Installation

For developing this extension clone this repository and install the dependencies via composer with composerinstall

3

TYPO3 Find Release 250

4 Chapter 1 Installation

CHAPTER 2

Aims

The extensions aims are to provide

bull access to arbitrary Solr indexes in TYPO3

bull minimal configuration for a basic display

bull rich templating abilities for creating complex displays

5

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 3: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

11 Prerequisites 33

12 Contact 35

13 Acknowledgements 37

ii

TYPO3 Find Release 250

This TYPO3 extension aims to enable the query and display of arbitrary Solr indexes

It provides the ability to configure many aspects of the query ndash eg query fields facets filtering through TypoScriptndash and set up the display through Fluid templates Partials for standard display features as well as a number of ViewHelpers that help creating those templates are included in the extension

Contents 1

TYPO3 Find Release 250

2 Contents

CHAPTER 1

Installation

For developing this extension clone this repository and install the dependencies via composer with composerinstall

3

TYPO3 Find Release 250

4 Chapter 1 Installation

CHAPTER 2

Aims

The extensions aims are to provide

bull access to arbitrary Solr indexes in TYPO3

bull minimal configuration for a basic display

bull rich templating abilities for creating complex displays

5

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 4: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

This TYPO3 extension aims to enable the query and display of arbitrary Solr indexes

It provides the ability to configure many aspects of the query ndash eg query fields facets filtering through TypoScriptndash and set up the display through Fluid templates Partials for standard display features as well as a number of ViewHelpers that help creating those templates are included in the extension

Contents 1

TYPO3 Find Release 250

2 Contents

CHAPTER 1

Installation

For developing this extension clone this repository and install the dependencies via composer with composerinstall

3

TYPO3 Find Release 250

4 Chapter 1 Installation

CHAPTER 2

Aims

The extensions aims are to provide

bull access to arbitrary Solr indexes in TYPO3

bull minimal configuration for a basic display

bull rich templating abilities for creating complex displays

5

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 5: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

2 Contents

CHAPTER 1

Installation

For developing this extension clone this repository and install the dependencies via composer with composerinstall

3

TYPO3 Find Release 250

4 Chapter 1 Installation

CHAPTER 2

Aims

The extensions aims are to provide

bull access to arbitrary Solr indexes in TYPO3

bull minimal configuration for a basic display

bull rich templating abilities for creating complex displays

5

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 6: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 1

Installation

For developing this extension clone this repository and install the dependencies via composer with composerinstall

3

TYPO3 Find Release 250

4 Chapter 1 Installation

CHAPTER 2

Aims

The extensions aims are to provide

bull access to arbitrary Solr indexes in TYPO3

bull minimal configuration for a basic display

bull rich templating abilities for creating complex displays

5

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 7: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

4 Chapter 1 Installation

CHAPTER 2

Aims

The extensions aims are to provide

bull access to arbitrary Solr indexes in TYPO3

bull minimal configuration for a basic display

bull rich templating abilities for creating complex displays

5

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 8: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 2

Aims

The extensions aims are to provide

bull access to arbitrary Solr indexes in TYPO3

bull minimal configuration for a basic display

bull rich templating abilities for creating complex displays

5

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 9: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

6 Chapter 2 Aims

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 10: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 3

Basic Example

For the most basic example you need to

1 add the find plug-in to a TYPO3 page

2 include the find plug-inrsquos template in your sitepagersquos template

3 configure your index information in the TypoScript template for that page At minimum you should set theaddress of your default Solr index and the fields to display in the result list

plugintx_findsettings connections

default options

host = solrlocalport = 8080path = solrmyIndex

standardFields

title = titlesnippet = publisher

With this setup find will give you a search form for your indexrsquo default search field and display a result list withthe documentrsquos raquotitlelaquo field as the heading of the item and the raquopublisherlaquo field added as a snippet beneath itEach result can be clicked to show the detail view for that document which presents a definition list of the fieldsin the Solr document

4 you can then add facets for text fields and numeric range selection eg

plugintx_findsettings facets

10

(continues on next page)

7

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 11: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

(continued from previous page)

id = formatfield = format

20

id = yeartype = Histogramfield = publishDateSort

5 additional query fields for an extended search option can also be added

plugintx_findsettings queryFields

10 id = titletype = Textextended = 1

There are many more TypoScript configuration options Please refer to the rest of this document and the exampleconfigurations provided in the Projects folder to learn about them

8 Chapter 3 Basic Example

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 12: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 4

Example projects

A few example projects can be found on github While you do not have the Solr indexes they are made for they maygive you an idea what more elaborate configurations may look like and how their templates are set up The projectsare

bull gbv basic configuration for a big library index with multiple search fields and facets but without customiseddisplay

bull hans simple configuration for a smaller library index with multiple search fields facets and mildly customisedtemplates

bull jfk-institut-zeitungen simple configuration with a single search field a non-trivial facet and a custom templatewithout detail view

bull Edfu elaborate configuration with two search fields two facets and highly customised display

bull GermaniaSacra elaborate configuration with many search fields facets data export complex queries and highlycustomised display

bull test configuration to demonstrate the settings of this Readme as well as the included View Helpers

These projects are structured in a common way (with potentially only a subset of the folders files existing)

bull projectnamets TypoScript configuration for the setup

bull EXT-Private symlink to the extensionrsquos ResourcesPrivate folder this is used as a scheme to link the extensionrsquospartials and templates into the custom configuration so they can be used in the custom configuration

bull TemplatesSearch typically some of these are symlinked to the originals

ndash Indexhtml and Detailhtml for the display

ndash Indexdata and Detaildata for loading data

ndash Suggestdata for autocomplete suggest responses

bull Partials Contains symlinks to the folders inside the extensionrsquos raquoPartialslaquo folder If the default partials are to be overridden a an actual folder with partials can be placed here You can also add your own partials folder of partials here The standard partials provided by the extension are in the folders

ndash Components elements used to create the page

9

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 13: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

ndash Display create markup for fields in the document

ndash Facets create facets

ndash Formats various output formats used by the data format

ndash Page standard elements to add to the page

ndash Pager creates the pager for result lists

bull Language localisation files or symlinks to the extensionrsquos localisation files

bull Resources JavaScript CSS images used by the projectrsquos templates and partials

10 Chapter 4 Example projects

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 14: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 5

TypoScript configuration options

All settings discussed in this section are inside the plugintx_findsettings array of the TypoScript config-uration

51 Connection to the Solr index

You can have multiple Solr connections Every connection needs to use a provider and an options array

The plugintx_findsettingsactiveConnection determines the currently used connection The de-fault value is default

The options settings array in a connection definition is used to configure access to the Solr index It contains

bull host [127001] hostname of the server running the index

bull port [8080] port of the Solr service on the server

bull path [solr] path of the Index on the Solr server

bull timeout [5] number of seconds before a Solr request times out

bull scheme [http] URI scheme of the connection

1 Example

plugintx_findsettings connections

default provider = SubugoeFindServiceSolrServiceProvideroptions

host = 127001port = 8080path = solrtimeout = 5scheme = http

(continues on next page)

11

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 15: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

(continued from previous page)

52 Solr Components

When using the eDisMax feature solr offers add

bull featureseDisMax = 1

53 The search form

The queryFields setting configures the search form It is a numbered array of arrays one for each query field thatcan be used The query fields have a number of parameters depending on their type

bull id (required) the id for the query field this is used in URL parameters (tx_find_find[q][myID]) andto identify the localised label for the query field

bull type (required) the type of the query field the partial with this name in PartialsFormFields is usedto create the field for input form the default set of partials provides the Text Range Hidden Select SelectFacetand Radio options a few of which depend on specific code in the controller to create the right queries

bull query a sprintf string with the Solr query for this field eg title_searchs if not given the defaultquery $ids is used (where $id is the value of the id field) this lets you use more complex queries (egquerying several fields at once or adding join to a query) it also supports multiple parameters (see theRange type)

bull extended [0] if true the query field will only be visible in the extended search form

bull noescape [0] if true the extension will not escape the user input before querying the index this allowstechnically inclined users to run their own Solr queries but it opens the risk of users accidentally enteringinvalid queries which will cause Solr exceptions (which the standard setup catches and offers the user a link forrunning an escaped query)

bull phrase [0] if true the string in the field will be phrase escaped ndash rather than term escaped ndash before beingplaced in the Solr query

bull hidden [0] if true the input field will not be displayed however the field will be displayed if a term for it ispassed in a search parameter

The default configuration sets up a general Text query for index 0 with id default as well as a Hidden field totransport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queriesfor index 10002 with id raw Please be aware of these configurations so you can override or delete them as needed

Some of the search field types have custom behaviour and specific configuration options

531 Text

The Text field can be the simplest field available It also allows advanced behaviour by adding autocomplete or acheckbox to select an alternate query style

bull queryAlternate an array of alternative queries that can be configured for the Text type it creates a check-box next to the input field which toggles between the provided query and the first queryAlternate

12 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 16: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

bull autocomplete [0] if true a field of Text type will be hooked up for autocompletion using Solr suggest query

bull autocompleteDictionary name of the dictionary the Solr suggest query should use

bull default default values to use in the query if no value is provided by the user (yet) may be a single valuestring (eg for the default state of checkboxes) or an array (especially useful for range queries)

Examples

plugintx_findsettingsqueryFields 10

id = nametype = Text

11

id = name2type = Textquery = name1$squeryAlternate1 = name1$s~07noescape = 1

12

id = name3type = Textautocomplete = 1autocompleteDictionary = name

532 Range

The Range field creates two text inputs for the arguments qfieldInfoid0 and qfieldInfoid1 This can be usedwith a query like from[ TO 2$s] AND to[1$s TO ] if your index has from and to fields Eg

plugintx_findsettingsqueryFields20 id = yeartype = Rangequery = from[ TO 2$s] AND to[1$s TO ]default0 = default1 =

533 Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form Eg

plugintx_findsettingsqueryFields30 id = hiddentype = Hiddendefault = surprise

53 The search form 13

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 17: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

534 Select

The Select field creates a popup menu The popup menu is set up using options with the default selectionlsquos key inthe key Eg

plugintx_findsettingsqueryFields40 id = countrytype = Selectoptions

blank =key = valuekey2 = value2

default = key

535 SelectFacet

The SelectFacet field creates a popup menu using the data from a facet that has been loaded For this to work the facetneeds to have been configured and its id has to be set as the facetID parameter Eg

plugintx_findsettings queryFields50

id = statustype = SelectFacetfacetID = statusquery = status_facets

facets50

id = statusfield = status_facethidden = 1fetchMinimum = 0

536 Radio

Creates radio buttons for the array set in the options array Eg

plugintx_findsettings 60

id = versionextended = 1type = Radiooptions

1 = Steak2 = Chicken3 = Pancake

default = 2

14 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 18: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

54 Default Display Fields

Two fields in the index document can be designated as the documentrsquos title and a snippet that are used to display theresult list This enable a simple initial configuration and should have many cases covered If you need to displaymore complex information in the result list that can be achieved by replacing the DisplayResult partial or ndash theIndex template

plugintx_findsettings standardFields

title = titlesnippet = detail

55 Default Query

By default all records in the index will be displayed when no search term is given the query is used for this Youcan change this default query (eg to a query with no results)

plugintx_findsettings defaultQuery =

56 Facets

Faceting can be configured in TypoScript using the facets setting It is a numbered list of arrays Each array canhave the keys

bull id (required) ID used to identify the facet

bull type [List] the type of facet to use (see below for the types provided by the extension)

bull field the Solr field to use for the facet if not given the field given by the id will be used

bull sortOrder [count] using index gives alphabetically sorted facet entries by default facet items are sortedby the number of results

bull fetchMinimum [1] the minimum number of facet entries needed to display the facet the facet will not beshown at all if there are fewer entries than this

bull fetchMaximum [100] the maximum number of facet entries to load

bull query sprintf style formatted string to use as a filter query if the facet is selected by default the facetrsquos field isused with the selected term

bull facetQuery array of facet query configuration arrays to use for creating specific facets each of the arrayshas the keys id to identify the facet query and query the Solr query to create the facet for

bull selectedByDefault array with keys field value and values 1 to indicate facet terms that should be selectedwhen no facet selection is given (especially useful with the Tabs facet type

bull excludeOwnFilter [0] if set to 1 the filters created by the facet itself will not be used when computing theresult count for its items

bull hidden [0] whether to hide the facet from display (eg to use the facet data in some other part of the pagelike a SelectFacet query field)

54 Default Display Fields 15

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 19: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

To change the defaults for these fields you can use the facetsDefaults setting and set your preferred defaultvalues there

The provided facet types are given by the partials in PartialsFacetsFacet The partial is picked using thetype configured for the facet

561 List

This is a default facet list displaying the facet name with a result count behind it You can use CSS to hide the resultcount if it is not needed

bull displayDefault [6] the number of facet items to display by default (the remaining ones are initially hiddenand can be revealed by the user)

bull autocomplete whether to offer an autocompletion search field above the facet items (helpful for facets withmany items)

bull sortPrefixSeparator this string is used to split the facetrsquos name into two parts and only display thesecond part this way you can sort by the first part (eg with zero-padded numbers) and still have good lookingfacet names

Examples

plugintx_findsettingsfacets 10

id = ordenfield = orden_facetautocomplete = 1

20

id = bandfield = band_facetsortOrder = indexdisplayDefault = 8sortPrefixSeparator =

562 Tabs

The Tabs style is a slight variation of the plain list As the name suggests it can be used to create raquoTabslaquo abovethe search results to allow users to pick a view on a certain subset of the data This can be particularly useful withpredefined facet queries to define the desired subsets

You will have to add the partial for this type of facet to your template yourself to make it appear at the top of the pageWhen doing so use the hidden setting to ensure it does not appear along with the other facets as well Turning onthe excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currentlyselected

Example a Tabs facet with facet queries for four specific document raquotyplaquo values selecting the raquoformularlaquo option bydefault

plugintx_findsettingsfacets 30

id = typexcludeOwnFilter = 1

(continues on next page)

16 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 20: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

(continued from previous page)

type = Tabshidden = 1selectedByDefault

formular = 1facetQuery

10 id = formularquery = typformular

20

id = wortquery = typwort

30

id = gottquery = typgott

40

id = ortquery = typort

563 Histogram

This facet is made for numeric fields It will draw a histogram to visualise the number of results per number in theindex It is a nice way to visualise a raquoyearlaquo facet You typically want a high fetchMaximum setting for the histogramfacet

bull barWidth the raquowidthlaquo of each of the bars in the histogram if you cover a wide number range it can beworthwhile to group the bars in wider ranges doing so requires an index that already contains rounded data(eg the rounded number of the decade instead of the precise year)

Example

plugintx_findsettingsfacets 40

id = decadefield = decadetype = HistogramsortOrder = indexfetchMaximum = 1000barWidth = 10

564 Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes Please look at thePartialsFacetsFacetMaphtml partial for details (This can still be improved in many ways)

Example

56 Facets 17

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 21: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

plugintx_findsettingsfacets 50

id = mapfield = geohashtype = MapsortOrder = indexfetchMaximum = 1000

57 Sorting

Sort behaviour can be configured using the sort setting It is an array of arrays with the fields id andsortCriteria The latter is a Solr sort order string ie a comma-separated list of the form fieldName[a|de]sc The id of the default sort order should be default

If the array has several elements a popup menu for selecting the sort order is added to the user interface

Example

plugintx_findsettingssort 1

id = defaultsortCriteria = year descname asc

58 Paging

Use the paging setting to adjust navigation in the results In this array you can set

bull perPage [20] the number of results per page

bull menu [array()] array of numbers used to create a menu from which users can pick the number of results perpage

bull maximumPerPage [1000] the maximum number of results to fetch from Solr even if the query asks for more

bull detailPagePaging [1] if 1 this enables paging between detail pages for a search

Example

plugintx_findsettingspaging perPage = 100maximumPerPage = 1000detailPagePaging = 1

581 Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corre-sponding to your Solr documents when RealURL is used and have paging between a resultrsquos detail page and the detailpages before and after it

18 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 22: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

This is achieved by POSTing information about the previous query along with the ID of the requested record sent inthe URL A drawback of this solution is that using the browserrsquos back button may trigger a raquoDo you want to submitthis form againlaquo dialogue Turn this option off if you donrsquot need paging between the detail pages

582 URL Parameters

You can also set the the number of results and the initial document in a server reply using the count and positionarguments The count will be limited by the maximumPerPage setting

59 Excluding documents

If your index contains documents that should never be shown (eg because they are not published yet or because youare using them for search but join them to other documents for display) you can add filter queries using theadditionalFilters setting The setting is an array with the filter queries as values

plugintx_findsettingsadditionalFilters 1 = publishedtrue

510 Choosing the fields to fetch

By default the complete Solr document is loaded and all its fields can be used If your documents are very large oryou want to avoid unnecessary highlighting it can be useful to explicitly state which fields are to be fetched ThedataFields setting lets you do this It has four sections default index detail data The extension willstart with the fields configured in default and add the fields given in the array for the action that is used

Each of these sections is an array with keys default (again) allow and disallow Typically you will only needthe default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields (Pleasenote that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field namewildcards) You may also use the data-fields argument in action URLs to overwrite the default configurationFor technical reasons the keys for the fields need to begin with a letter rather than just be a number (eg use f1 insteadof 1)

Example configuration to only load minimal fields by default and load all fields for the detail and data actions

plugintx_findsettings dataFields

default default

f0 = idf1 = kloster

detail

default f0 =

data lt plugintx_findsettingsdataFieldsdetail

59 Excluding documents 19

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 23: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

511 Highlighting

The use of Solrrsquos result highlighting is configured by the highlight setting Similar to the dataFields settingit contains arrays default index detail and data Each of which can contain the following fields

bull fields [f1 = ] an array of field names its keys should begin with a letter for technical reasons (ie f1instead of 1

bull fragsize [100] the maximum length of the highlighted fragment

bull query a custom sprintf-style query templat to use for highlighting

bull useQueryTerms [0] set to 1 to create highlight queries for each query term from the search form

bull useFacetTerms [0] set to 1 to create highlight queries for each selected facet term

bull alternateFields an array with keys the field name and values the corresponding alternate field name forsituations where the highlighting does not work in the field itself

Please note that particularly the final three options do not seem ideal yet and are considered experimental Changesmay be needed in the future to make these more versatile in complicated situations

Example highlighting just a few fields by default and a wider range of fields for the detail action As it is used withjoin queries the terms from queries and facets are explicitly added again for highligh queries

plugintx_findsettingshighlight default

fields f1 = kloster

useQueryTerms = 1useFacetTerms = 1

detail

fields f2 = patroziniumf3 = ortf4 = bistumf5 = landf6 = ordenf7 = bemerkung_kloster

512 Linking to data fields

When displaying field content with the PartialsDisplayFieldContent partial (or its siblings who useit) the linkFieldContent argument can be give to not just display the field content but insert a link to search alldocuments with the same value in that field Without further configuration this will create a raw query where the usermay see the Solr query It can be desirable to instead hide the Solr query syntax and define a (potentially hidden)query field for that Solr field and then just fill that field with the term only

The queryFieldForDataField setting is an array with keys Solr field names and values IDs of queryFieldswhich creates the mapping needed for creating those queries

Example

20 Chapter 5 TypoScript configuration options

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 24: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

plugintx_findsettings queryFields

100 id = citytype = Texthidden = 1phrase = 1

queryFieldForDataField city = city

513 Jumping to the content

By default the extension creates links that jump to the extensionrsquos content (tx_find) on the target page to maximisethe visible space for search results and information that may otherwise be wasted for the pagersquos head You can removethe anchor to jump to or pick another one on your page (eg to leave site navigation visible) with the jumpToIDsetting

plugintx_findsettingsjumpToID = menu

514 JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to beadded to the page The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 ofJSPaths Eg

plugintx_findsettings CSSPaths30 = EXTfindProjectstestResourcestestcssJSPaths20 = EXTfindProjectstestResourcestestjs

jQuery has to be included manually on your TypoScript PAGE-object of choice Example

pageincludeJSFooterlibsjquery = httpscdnjscloudflarecomajaxlibsjquery311rarr˓jqueryminjspageincludeJSFooterlibsjqueryexternal = 1pageincludeJSFooterlibsjqueryintegrity = sha256-rarr˓hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=pageincludeJSFooterlibsjqueryUi = httpscdnjscloudflarecomajaxlibsjqueryui1rarr˓121jquery-uijspageincludeJSFooterlibsjqueryUiexternal = 1pageincludeJSFooterlibsjqueryUiintegrity = sha256-rarr˓T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=

513 Jumping to the content 21

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 25: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

515 Localisation

You can set the languageRootPath pointing to your own Localisations folder The partials included withthe extension will honour that path when accessing their localisation files As with the partials and templates it can behandy to symlink some of the default localisation files and just override or add the additional terminology you need

plugintx_findsettingslanguageRootPath = EXTfindProjectstestLanguage

Localisation files used by the included partials are

bull locallangxml general terminology for the search interface (the default file)

bull locallang-formxml labels and placeholders for the search form

bull locallang-facetsxml facet names and facet item names

bull locallang-fieldsxml field labels

Please refer to the initial comments in those files for the conventions used to create the localisation keys based on theid s of the respective query fields facets or fields

22 Chapter 5 TypoScript configuration options

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 26: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 6

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your indexcontent To do that create a project structure along the lines of the included example projects symlink the parts of theextensionrsquos templates and partials you want to use and overrideadd your own

The extension comes with a large number of View Helpers and partials that can be helpful in that context Lookaround the ClassesViewHelpers and ResourcesPrivatePartials folders to see which parts of thework have already been done for you

Most of the View Helpers come with usage examples in the Test partial of the test project and appear on its startpage (the search interface appears after those examples) once you have it set up

23

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 27: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

24 Chapter 6 Templating

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 28: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 7

Actions

The extension provides three actions

bull index the default action that performs searches

bull detail the action to display a single document (automatically triggered if the id argument is present)

bull suggest used for the autocomplete setup of Text query fields

25

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 29: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

26 Chapter 7 Actions

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 30: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 8

Data export

Creating data exports requires the following setup

bull set up a TYPO3 page type without HTML and the MIME Type you need the extension provides type1369315139 one for JSON

tx_find_page = PAGEtx_find_page

typeNum = 136931513910 lt tt_contentlist20find_findconfig

disableAllHeaderCode = 1additionalHeaders = Content-typeapplicationjsoncharset=utf-8

bull create a link with flinkaction using the pageType you need format=data and add the argumentdata-format with the name of the format you want to the query

bull create a partial for your data format in PartialsFormats with the data file name extension and createthe desired output there

Example output formats eg for JSON are available in the extension The germania-sacra project contains additionalones

27

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 31: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

28 Chapter 8 Data export

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 32: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 9

Query String Arguments

The plug-inrsquos query parameters are of the form tx_find_find[parameterName]

91 Standard arguments

Built-in parameter names are

bull id the Solr document ID of the document to show in the detail action having the id argument will alwaystrigger the detail action

bull q for the query this is an array with keys the queryField IDs eg tx_find_find[q][default]=termsome query field types (eg Range) use an array as their value to cover both their input values

bull facet for selected facets this is an array with keys the facet IDs and values arrays those arrays have keysthe facet term and value 1 eg tx_find_find[facet][typ][formular]=1

bull page the page of results to show (1-based)

bull extended whether to show the extended search form

bull sort the sort order to use

92 Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extensionspecifically when using the data action

bull start the document index to start at in the result set

bull count the number of documents to ask Solr for (limited by the pagingmaximumPerPage setting)

bull data-format when using the data format this file in PartialsFormats will be used to create theoutput

29

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 33: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

93 POST arguments

bull underlyingQuery information about the underlying query sent in the POST body when pagingdetailPagePaging is turned on it may contain the keys q facet position count and sort

30 Chapter 9 Query String Arguments

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 34: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 10

RealURL

The extension includes a hook for RealURL autoconfiguration It mainly handles the parameter name for the detailview by using a iddocumentID path segment

URLs for queries and faceting are not prettified and ndash if required ndash will need to be manually configured due to thequery parameter names depending on the id s used for fields and facets

31

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 35: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

32 Chapter 10 RealURL

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 36: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 11

Prerequisites

bull TYPO3 62 or higher

bull PHP 55 or higher

33

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 37: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

34 Chapter 11 Prerequisites

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 38: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 12

Contact

bull Sven-S Porst SUB Goumlttingen

bull Ingo Pfennigstorf SUB Goumlttingen

35

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 39: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

TYPO3 Find Release 250

36 Chapter 12 Contact

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements
Page 40: Release 2.5.0 Sven-S. Porst, Ingo Pfennigstorf

CHAPTER 13

Acknowledgements

The extensionrsquos Solr connectivity is provided by the Solarium PHP Solr client (github)

37

  • Installation
  • Aims
  • Basic Example
  • Example projects
  • TypoScript configuration options
    • Connection to the Solr index
    • Solr Components
    • The search form
    • Default Display Fields
    • Default Query
    • Facets
    • Sorting
    • Paging
    • Excluding documents
    • Choosing the fields to fetch
    • Highlighting
    • Linking to data fields
    • Jumping to the content
    • JavaScript and CSS resources
    • Localisation
      • Templating
      • Actions
      • Data export
      • Query String Arguments
        • Standard arguments
        • Special arguments
        • POST arguments
          • RealURL
          • Prerequisites
          • Contact
          • Acknowledgements