Download the PHP package pixelpoems/silverstripe-search without Composer

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

Silverstripe Search Module

stability-beta

This module provides a silverstripe search using ajax and configurable indexing. You can use it in combination with Silverstripe Elemental and Fluent. For Elemental and Fluent configuration check the specified documentation below.

Requirements

Installation

This module includes

Configuration

Without any special configurations all pages and subclasses of page, which have the "Show in Search" Checkbox checked, will be indexed. For indexing you have to run the PopulateSearch Task (More Details: Populate Task).

Following variables can be used to configure your search index:

Those keys are only for separating data within the index (more or less for your own structure - this keys won't be displayed in the search result!). The search prioritises the content based on the keys - title has the first priority in this case and is therefore also displayed first in the result.

By default, your index file is named index.json and will be placed at /search/ within your project root directory. Add /search to your .gitignore to prevent index files from being pushed to your git repository.

To Update or set the index keys based on the Class you can extend the Class and use the following method to set the values. If you set extra values here, they won't get noticed by the js logic. Only the predefined keys will be recognised. $datawill contain all preconfigured keys.

To update the data without extension e.g. on a new PageType you can add the following function to your new Page Type with your custom list, which should be indexed:

To add multiple values e.g. Tags or something similar you can do like this:

You can use the SearchService::escapeHTML($string) function to escape your content before adding it to the index.

Populate Task

To create or update the search index use the "Search Populate" Task:

This Task will create based on your configuration an index.json and an index-elemental.json (if elemental is enabled) or locale.json and locale-elemental.json (if fluent is enabled).

You can extend the search population and add additional Data like that:

Your Data will be saved within index.json or locale.json

ATTENTION: Make sure your DataObject has a Link function, so that it can be linked within the search result.

If you want to populate custom data without an DataObject you can add a "link" key to your custom array:

This will generate a custom Array Data with your context - in the ideal case the array contains the keys id, link and your defined index_keys.

Overwrite Template Files

To overwrite the default search templates you can create a Pixelpoems/Search folder within your project templates.

ATTENTION: If you overwrite the templates, make sure that the required js files are included within the templates or will be included via a Controller and the CSS Classes and IDs are there as well. Make sure that the inline search is wrapped within an element with the classes search-holder inline-search-holder and within a search-holder class on the search page template!

If you need additional Variables within your Ajax Search Result List Template Pixelpoems/Search/Ajax/SearchResultList.ss you can extend the Pixelpoems/Search/Controllers/SearchController and update the data with the following hook:

All the Variables, that are added here can be accessed in your custom Ajax/SerachList.ss.

Inline Search

This module includes an inline search. The listing within the inline search will display up to ten search results and a "See more..." item which navigates to the search page which will display all search results in a list.

Include the InlineSearch Template within your template:

Enable Search on DataObjects

If you want to add data of an DataObject you can add text like described in the Configuration section indexing a page or an element. Here you can add e.g. the title and content within the index process of a single page along to all other objects.

Config to enable Elemental

To enable indexing elemental add the following to your configuration yml:

Furthermore, you can use exclude_elements_from_index to prevent specific Element Classes from being indexed:

And add the SearchIndexExtension to the Base Element Model:

After adding the extension you can use the updateSearchIndexData hook to specify your index data.

Enable Virtual Element Indexing

If you use Virtual Elements from DNADesign and you want to index the Connected Data for this element you can add the following Extension to the base "ElementVirtual" Class, this will handle the default indexing with the "Linked Element" Data.

Config to enable Fluent

To enable fluent within the index and search process add the following to your configuration yml:

If you enabled fluent threw the config the Populate Search Task will create an index file for every locale. To prevent a locale from beeing indexed you can add the Locale title within the static variable exclude_locale_from_index like this:

By default, your index files are named {locale}.json, e.g. de_AT.json.

Modify Search Result

There are multiple hooks to modify the search result before sending the generated list to the template:

Add an extension to SearchService:

Modify List BEFORE limiting result

Use the hook updateSearchResultBeforeLimit for instance to filter the results on a specific Mulitsite if you use e.g. https://github.com/symbiote/silverstripe-multisites

The limitation of the list (for Inline Search) will be added after the hook.

Modify List AFTER limiting result

Use the hook updateSearchResultAfterLimit for instance to filter the results after the limitation has been added to the list.

This will hook will only be called on a request that is made by the inline search! If you want to modify the result after limitation for inline search AND on the Search page use the hook updateSearchResult:

Available Config Variables

Every config can be made via the Pixelpoems\Search\Services\SearchConfig class:

Name Default
enable_default_style true
index_keys ['title']
enable_fluent false
exclude_locale_from_index []
enable_elemental false
exclude_elements_from_index []
max_results_inline 10

Reporting Issues

Please create an issue for any bugs you've found, or features you're missing.

Credits

Search and Close icons from Feather Icons - https://feathericons.com/


All versions of silverstripe-search with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
silverstripe/cms Version ^4
silverstripe/framework Version ^4.0
silverstripe/vendor-plugin Version ^1.0
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 pixelpoems/silverstripe-search contains the following files

Loading the files please wait ....