2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

image

i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 8 Forks
  • 2 Open issues
  • 14 Versions
  • 5 % Grown

The README.md

silverstripe-searchable

Adds to the default Silverstripe search by adding a custom results controller and allowing properly adding custom data objects and custom fields for searching, (*1)

Installation

Install this module either by downloading and adding to:, (*2)

[silverstripe-root]/searchable, (*3)

Then run: http://yoursiteurl.com/dev/build/, (*4)

Or alternatively add to your projects composer.json, (*5)

Usage

To add your object to the search results, you need to make Searchable aware of it. Do this by adding the following to your _config.php:, (*6)

Searchable::add("ObjectClass", array("Col1","Col2"), "Friendly Title");

This will then add the object to Searchable's searchable classes., (*7)

For example, you can add SiteTree using the following:, (*8)

Searchable::add("SiteTree", array("Title","MenuTitle","Content","URLSegment"), "Pages");

NOTE Searchable will check an object's canView method before adding it to the list of results. If this returns true (the Silverstripe default for users not logged in) then the object will not appear., (*9)

If you do not require custom view permissions, then the simplest thing to do is add the following function to your dataobject:, (*10)

function canView($member = null)
{
    return true;
}

Extended Dataobjects

At the moment Searchable generates errors if you want to try and search an object that extends another object using the fields of it's parent., (*11)

For example, the below will generate an error:, (*12)

Searchable::add("Page", array("Title","MenuTitle"), "Pages");

You will have to search SiteTree (as it contains the fields Title and Menutitle)., (*13)

Results Dashboard

As Searchable can display results for multiple types of object, the default interface used to display these objects is the "dashboard"., (*14)

The dashboard displays a summary of results for each object and generates a view more link to display more of that type of post (for example, more products, more forum posts, etc)., (*15)

You can customise how many items are displayed on the dashboard with the config variable:, (*16)

Searchable.dashboard_items

If searchable is only setup for one type of object, the dashboard will be disabled and instead the user will be taken directly to a search results page for that object., (*17)

Custom search templates

By default the search results are rendered into two templates:, (*18)

SearchResults.ss

Or, (*19)

SearchResults_object.ss

The former controls the apperance of the dashboard, the latter controls the apperance of the results for a particular object., (*20)

You can further customise how the results appear on an object specific bases by adding a template named after the object in question, for example:, (*21)

SearchResults_Product.ss

The above would be used to display only search results for a product object., (*22)

Overwrite the default page length

You can change the default page length of search results by using configuration:, (*23)

Searchable::config()->page_lenth = 20;

Or, in config.yml, (*24)

Searchable:
  page_lenth: 20

Custom results controller

It's possible to change the default controller used by searchabe to display results. You can do this by changing the template class configuration variable:, (*25)

Searchable::config()->template_class = 'your_custom_controller';

Or, in config.yml, (*26)

Searchable:
  template_class: 'your_custom_controller'

The Versions

12/03 2018

2.x-dev

2.9999999.9999999.9999999-dev http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

by Mo

search silverstripe dataobject searchform

12/03 2018

2.0.4

2.0.4.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

by Mo

search silverstripe dataobject searchform

12/03 2018

1.x-dev

1.9999999.9999999.9999999-dev http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

search silverstripe dataobject full text

12/03 2018

1.1.3

1.1.3.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

search silverstripe dataobject full text

06/03 2018

2.0.3

2.0.3.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

by Mo

search silverstripe dataobject searchform

22/01 2018

2.0.2

2.0.2.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

by Mo

search silverstripe dataobject searchform

22/01 2018

1.1.2

1.1.2.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

search silverstripe dataobject full text

20/01 2018

2.0.1

2.0.1.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

by Mo

search silverstripe dataobject searchform

20/01 2018

1.1.1

1.1.1.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

search silverstripe dataobject full text

20/01 2018

2.0.0

2.0.0.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

by Mo

search silverstripe dataobject searchform

20/01 2018

1.1.0

1.1.0.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

search silverstripe dataobject full text

20/01 2018

1.0.1

1.0.1.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

search silverstripe dataobject full text

09/11 2016

dev-master

9999999-dev http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

search silverstripe dataobject full text

09/11 2016

1.0

1.0.0.0 http://github.com/i-lateral/silverstripe-searchable

Updated search module for Silverstripe allowing addition of different data objects and makes use of the FulllTextFilter

  Sources   Download

BSD-3-Clause

The Requires

 

search silverstripe dataobject full text