Download the PHP package subugoe/find without Composer

On this page you can find all versions of the php package subugoe/find. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package find

Find

image

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 – e.g. query fields, facets, filtering through TypoScript – and set up the display through Fluid templates. Partials for standard display features as well as a number of View Helpers that help creating those templates are included in the extension.

Installation

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

Aims

The extensions aims are to provide:

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-in’s template in your site/page’s template
  3. configure your index information in the TypoScript template for that page. At minimum you should set the address of your default Solr index and the fields to display in the result list:

    With this setup, find will give you a search form for your index’ default search field and display a result list with the document’s »title« field as the heading of the item and the »publisher« field added as a snippet beneath it. Each result can be clicked to show the detail view for that document which presents a definition list of the fields in the Solr document.

  4. you can then add facets for text fields and numeric range selection, e.g.:

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

There are many more TypoScript configuration options. Please refer to the rest of this document and the linked example configurations to learn about them.

Example projects

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

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

TypoScript configuration options

All settings discussed in this section are inside the plugin.tx_find.settings array of the TypoScript configuration.

Connection to the Solr index

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

The plugin.tx_find.settings.activeConnection determines the currently used connection. The default value is default.

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

  1. Example:

Solr Components

When using the eDisMax feature solr offers, add

In case the Solr version is lower than 8, the setting plugin.tx_find.settings.luceneMatchVersion has to be set to the major version that is used (for instance 6 or 7). By default this is set to 8 and affects a magic query prefix (see https://lucene.apache.org/solr/guide/6_6/the-extended-dismax-query-parser.html#TheExtendedDisMaxQueryParser-Usingthe_magicfields__val_and_query_).

The search form

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

The default configuration sets up a general Text query for index 0 with id default, as well as a Hidden field to transport the state of the search form with for index 10001 with id extended and a Text field for raw Solr queries for 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.

Examples:

Text

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

Examples:

Range

The Range field creates two text inputs for the arguments q.{fieldInfo.id}.0 and q.{fieldInfo.id}.1. This can be used with a query like from:[* TO %2$s] AND to:[%1$s TO *] if your index has from and to fields. E.g.:

Hidden

The Hidden field creates an input element of type hidden to pass additional parameters through the form. E.g.:

Select

The Select field creates a popup menu. The popup menu is set up using options, with the default selection‘s key in the key. E.g.:

SelectFacet

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

Radio

Creates radio buttons for the array set in the options array. E.g.:

Default Display Fields

Two fields in the index document can be designated as the document’s title and a snippet that are used to display the result list. This enable a simple initial configuration and should have many cases covered. If you need to display more complex information in the result list, that can be achieved by replacing the Display/Result partial or – the Index template.:

Default Query

By default all records in the index will be displayed when no search term is given: the query *:* is used for this. You can change this default query (e.g. to a query with no results):

Default search operator

If you want to change the default search operator you can use the following configuration:

Facets

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

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

The provided facet types are given by the partials in Partials/Facets/Facet. The partial is picked using the type configured for the facet.

List

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

Examples:

Tabs

The Tabs style is a slight variation of the plain list. As the name suggests, it can be used to create »Tabs« above the search results to allow users to pick a view on a certain subset of the data. This can be particularly useful with predefined 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 page. When doing so use the hidden setting to ensure it does not appear along with the other facets as well. Turning on the excludeOwnFilter setting will ensure you get correct result counts for the facet items which are not currently selected.

Example: a Tabs facet with facet queries for four specific document »typ« values, selecting the »formular« option by default:

Histogram

This facet is made for numeric fields. It will draw a histogram to visualise the number of results per number in the index. It is a nice way to visualise a »year« facet.

You typically want a high fetchMaximum setting for the histogram facet. Setting excludeOwnFilter = 1 will not remove the filtered values from the facet as usual but keep the previous hustogram and highlight the selected range.

Example:

The Histogram facet uses the jQuery.flot and jQuery.flot.selection 0.8.3 libraries from flotcharts. Be sure to download them and serve them with your page, e.g. by adding the paths to the files to page.includeJS in TypoScript after jQuery.

Map

This face creates a tiny Google map from a Solr field containing specifically formatted geohashes. Please look at the Partials/Facets/Facet/Map.html partial for details. (This can still be improved in many ways.)

Example:

Sorting

Sort behaviour can be configured using the sort setting. It is an array of arrays with the fields id and sortCriteria. The latter is a Solr sort order string, i.e. 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:

Paging

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

Example:

Detail Page Paging

The detailPagePaging option enables a feature that lets you have pretty and unique URLs for the pages corresponding to your Solr documents when RealURL is used and have paging between a result’s detail page and the detail pages before and after it.

This is achieved by POSTing information about the previous query along with the ID of the requested record sent in the URL. A drawback of this solution is that using the browser’s back button may trigger a »Do you want to submit this form again?« dialogue. Turn this option off if you don’t need paging between the detail pages.

URL Parameters

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

Excluding documents

If your index contains documents that should never be shown (e.g. because they are not published yet or because you are using them for search but {!join} them to other documents for display), you can add filter queries using the additionalFilters setting. The setting is an array with the filter queries as values:

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 or you want to avoid unnecessary highlighting, it can be useful to explicitly state which fields are to be fetched. The dataFields setting lets you do this. It has four sections default, index, detail, data. The extension will start 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 need the default array but the other keys can be used to force-add fields or explicitly prohibit the output of fields. (Please note that this will not be a failsafe guarantee that users cannot see those field due to the various actions or field name wildcards.) You may also use the data-fields argument in action URLs to overwrite the default configuration. For technical reasons the keys for the fields need to begin with a letter rather than just be a number (e.g. use f1 instead of 1).

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

Highlighting

The use of Solr’s result highlighting is configured by the highlight setting. Similar to the dataFields setting, it contains arrays default, index, detail and data. Each of which can contain the following fields:

Please note that particularly the final three options do not seem ideal yet and are considered experimental. Changes may 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 with {!join} queries, the terms from queries and facets are explicitly added again for highligh queries:

Linking to data fields

When displaying field content with the Partials/Display/Field/Content partial (or its siblings who use it) the linkFieldContent argument can be given to not just display the field content but insert a link to search all documents with the same value in that field. Without further configuration this will create a raw query where the user may 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 queryFields which creates the mapping needed for creating those queries.

Example:

Jumping to the content

By default the extension creates links that jump to the extension’s content (#tx_find) on the target page to maximise the visible space for search results and information that may otherwise be wasted for the page’s head. You can remove the anchor to jump to or pick another one on your page (e.g. to leave site navigation visible) with the jumpToID setting:

plugin.tx_find.settings.jumpToID = menu

JavaScript and CSS resources

Settings include the JSPaths and CSSPaths arrays which can be used to configure JavaScript and CSS files to be added to the page. The default setup configures files at positions 10 and 20 of CSSPaths and at position 10 of JSPaths. E.g.:

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

Localisation

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

plugin.tx_find.settings.languageRootPath = EXT:find/Projects/test/Language/

Localisation files used by the included partials are:

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

Templating

You probably want to create your own templates and partials to tailor the display of your search results for your index content. To do that create a project structure along the lines of the included example projects, symlink the parts of the extension’s templates and partials you want to use and override/add your own.

The extension comes with a large number of View Helpers and partials that can be helpful in that context. Look around the Classes/ViewHelpers and Resources/Private/Partials folders to see which parts of the work 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 start page (the search interface appears after those examples) once you have it set up.

Actions

The extension provides three actions:

Data export

Creating data exports requires the following setup:

Example output formats, e.g. for JSON, are available in the extension. The germania-sacra project contains additional ones.

Query String Arguments

The plug-in’s query parameters are of the form tx_find_find[parameterName].

Standard arguments

Built-in parameter names are

Special arguments

These arguments are not typically exposed but can be useful when providing data exports through the extension, specifically when using the data action.

POST arguments

Logging

The TYPO3 Log Manager is used. If no special configuration for the find-logging is applied, log entries can be found under the component-key find in the TYPO3 log, i.e.:

06 Jun 2016 06:36:06 +0000 [ERROR] request="e2737b83ada7d" component="find": Solr Exception (Timeout?)

RealURL

The extension includes a hook for RealURL autoconfiguration. It mainly handles the parameter name for the detail view by using a id/documentID path segment.

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

Prerequisites

Testing

To run the unit tests, clone this repository, and run

Contributing

Open a pull request on Github.

Make sure to run composer lint before to see, if the coding style is met. If not, this can be automatically fixed with composer fix.

Building CSS files

Install Node.js (version 16 or above), run npm install and build the final CSS file with npm run build.

Contact

Acknowledgements

The extension’s Solr connectivity is provided by the Solarium PHP Solr client


All versions of find with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4
ext-curl Version *
ext-json Version *
solarium/solarium Version >=6.0 <7.0
typo3/cms-core Version ^10.4.10
typo3/cms-felogin Version ^10.4.10
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package subugoe/find contains the following files

Loading the files please wait ....