Download the PHP package contentreactor/craft-search without Composer

On this page you can find all versions of the php package contentreactor/craft-search. 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 craft-search

ContentReactor Search

Search for the pages Field Value Parser parses. Pages' searchable content is indexed with the SEARCH purpose, and kept up to date from the queue as their content, or the content of anything they include, changes.

Requirements

Craft CMS 5.9+ and marcusgaius/field-value-parser, whose parsing library it builds on. It has a control panel section of its own and doesn't need the Field Value Parser plugin's screens or settings.

Installation

Setup

In the control panel, Search → Setup picks and checks an index, the indexed element types and the endpoint. craft cr-search/setup does the same from the command line.

Configuration

Settings can be overridden in config/cr-search.php. Facets can only be set there, as changing them requires rebuilding the index:

A facet's width (auto, quarter, third, half or full) is how much of a row its filter wants in a search form. The baseline search page follows it, and templates can read it as facet.width.

PostgreSQL languages

On PostgreSQL, the database index stems words and leaves out stopwords in each site's language, with PostgreSQL's built-in text search configuration for it (german for de-AT, english for en-US, and so on). Languages without one use simple, which does neither. Other configurations, e.g. ones you've created with extra dictionaries, can be set per language:

Rebuild the index after changing these, or a site's language.

Templates

cr-search/results and cr-search/form are the baseline templates; Search → Settings can replace them with your own.

Search analytics

Searches from the search results endpoint and GraphQL are logged with their term, site and result count, and nothing identifying who searched. Search → Analytics lists the top searches and the searches that found nothing, for users with the View search analytics permission.

Searches from Twig or PHP are only logged when asked to, so searches like a page's related pages don't count:

logSearches turns logging off, and searchLogDays sets how many days searches are kept (90 by default, 0 for forever). Older ones are deleted with Craft's garbage collection.

Synonyms

Search → Synonyms holds groups of words that match each other, for all sites or one, for users with the Manage synonyms permission. A search for any of a group's words finds pages with the others too, so gig tickets finds pages about concert tickets. Synonyms are single words, as searches match word by word, and they take effect without rebuilding the index. Searches that found nothing, in Search → Analytics, are a good place to find them.

A query's own synonyms can be set instead of the site's, e.g. from Search::EVENT_BEFORE_SEARCH:

Excluding pages

Pages can be kept out of search, from least to most specific:

Changing the excluded sources or entry types in the control panel rebuilds the index. Plugins can decide with their own rules too:

Pinned results

Search → Pinned Results shows chosen entries first, in a set order, for a search term on all sites or one, for users with the Manage pinned results permission. They're shown when a search's term is exactly the pinned term, ignoring case and extra spaces, and only when they match the search's filters. Pinned pages take the first places of the results, so pages of results, totals and facet counts include them once. Search → Analytics links searches that found nothing to pinning results for them.

Results say which of their pages are pinned, e.g. to mark them:

Any pages can be pinned from code, for a query of their own, with $event->query->pinnedElementIds in Search::EVENT_BEFORE_SEARCH. An empty array shows none.

GraphQL

Schemas with the Search component can use the crSearch query. Searches are kept to the sites, sections, volumes, category groups and tag groups the schema can read, so totals and facet counts only include what it can see.

filters take values (any of which matches) or a min and/or max range. facets limits which facets are counted, and limit changes the results per page.

Events

Search::EVENT_BEFORE_SEARCH and Search::EVENT_AFTER_SEARCH fire around every search, including the ones counting facet values for search forms (those have a limit of 0):

Editions

Search comes in two editions, from the Plugin Store:

Lite Pro
Database index, on MySQL and PostgreSQL ✓ ✓
Facets, excluded pages, the search results endpoint, GraphQL ✓ ✓
Elasticsearch index ✓
Synonyms ✓
Pinned results ✓
Search analytics ✓

On Lite, the Pro screens aren't listed, and searches leave synonyms, pinned results and logging out. A configured Elasticsearch index leaves search off on Lite rather than using it.

Support

The plugin registers the cr-search handle, the ContentReactor\Search namespace and {{%contentreactor_search_*}} tables.

Report issues at https://github.com/contentreactor/craft-search/issues, or write to [email protected].

License

The Craft License, see LICENSE.md.


All versions of craft-search with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
craftcms/cms Version ^5.9
marcusgaius/field-value-parser Version ^1.1
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 contentreactor/craft-search contains the following files

Loading the files please wait ...