Download the PHP package silverstripe/silverstripe-discoverer-bifrost without Composer

On this page you can find all versions of the php package silverstripe/silverstripe-discoverer-bifrost. 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 silverstripe-discoverer-bifrost

🧭 Silverstripe Discoverer > Silverstripe Search

Purpose

Perform search queries on your Silverstripe Search data through Silverstripe CMS controllers.

This module is used to integrate with the 🌈 Bifröst - the API for Silverstripe's Search service.

Installation

Engine vs Index

[!IMPORTANT] TL;DR:\ For all intents and purposes, "engine" and "index" are synonomous. If we refer to something as "engine", but the Discoverer module is asking for an "index", then you simply need to give it the data you have for your engine.

The Discoverer module is built to be service agnostic; meaning, you can use it with any search provider, as long as there is an adaptor (like this module) for that service.

When Discoverer refers to an "index", it is talking about the data store used for housing your content. These data stores are known by different names across different search providers. Algolia and Elasticsearch call them "indexes", Typesense calls them "collections", App Search calls them "engines". Discoverer had to call them something in its code, and it chose to call then "indexes"; Silverstripe Search, however, calls them "engines".

Actions apply in the same way to all of the above. In Silverstripe Search, the action of "indexing" is the action of adding data to your engine, where it is said to be "indexed". Updating that data is commonly referred to as "re-indexing".

Specify environment variables

To integrate with Silverstripe Search, define environment variables containing your endpoint, engine prefix, and query API key.

Understanding your engine prefix and suffix:

[!IMPORTANT] TL;DR:

  • All Silverstripe Search engine names follow a 4 slug format like this: search-<subscription>-<environment>-<suffix>
  • Your <engine-prefix> is everything except -<suffix>; so, it's just search-<subscription>-<environment>

For example:

Engine Engine prefix Engine suffix
search-acmecorp-prod-main search-acmecorp-prod main
search-acmecorp-prod-inc search-acmecorp-prod inc
search-acmecorp-uat-main search-acmecorp-uat main
search-acmecorp-uat-inc search-acmecorp-uat inc

Why?

Because you probably have more than one environment type that you're running search on (e.g. Production and UAT), and (generally speaking) you should have different engines for each of those environments. So, you can't just hardcode the entire engine name into your project, because that code doesn't change between environments.

Whenever you make a query, Discoverer will ask you for the "index" name; you will actually want to provide only the <suffix>. We will then take BIFROST_ENGINE_PREFIX and your <suffix>, put them together, and that's what will be queried. This allows you to set BIFROST_ENGINE_PREFIX differently for each environment, while having your <suffix> hardcoded in your project.

More on this in Usage

Usage

As mentioned above, this module serves as an "adaptor provider" for Discoverer. Besides the installation steps above, you shouldn't really be interacting with this module in your code.

That said, below is a very simple examples on how to get your first query and results, but please see the documentation provided in Discoverer for more details on how to build queries and display results.

Building a query

Instantiate the search service:

Create a new query:

When performing a search, Discoverer will ask you for the Query object (above), and the "index" to be queried. This should just be the engine <suffix> (mentioned in Understanding your engine prefix and suffix):

Processing results

For this quick example, we'll assume we had a couple of fields in our engine: title, content (more on fields in Understanding fields and results)

You have your $results (a Results object). You can now loop through its Records, which is just a paginated list of Record.

In PHP:

Or in your template:

Understanding fields and results

The Discoverer module attempts to standardise all data store (index/engine/collection) fields into a "Silverstripe'y" format that we're all familiar with - PascalCase.

For example:

Engine field Discoverer results field
id Id
record_id RecordId
title Title
content Content
meta_image_url MetaImageUrl
elemental_area ElementalArea
taxonomy_term_ids TaxonomyTermIds

Note: Abbreviations like id, or url are treated like any other word, so even though it's quite common practice in Silverstripe to name it an ID (both capitalised), Discoverer will convert these to Id and Url respectively.

Why?

Because the Discoverer module has no way to programatically understand what abbreviation you might have in your code, so it's better to just use a standard across anything and everything that looks like a word.


All versions of silverstripe-discoverer-bifrost with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
silverstripe/framework Version ^5
silverstripe/silverstripe-discoverer-elastic-enterprise Version ^2
guzzlehttp/guzzle Version ^7.5
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 silverstripe/silverstripe-discoverer-bifrost contains the following files

Loading the files please wait ....