Skip to content

Commit

Permalink
style #277 Docs improvements (sstok)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.0-dev branch.

Discussion
----------

The SearchProcessor, Optimizers and support for Array and XML input has been long removed. However the documentation was not updated, and I improved some other things.



Commits
-------

210c4ac [Doc] Clean-up removed features
95b075f [Doc] Remove mentioning of v1.0 (unmaintained)
136b9ec [Doc] Simplify introduction by moving some parts
0a5d2c6 [Doc] rewrite installation instructions
a4d0563 [Doc] Update processing instructions
dc6ab83 [Doc] correct some minor types
afebc9d [Doc] Update Symfony bundle examples
  • Loading branch information
sstok committed Aug 28, 2019
2 parents 531ec8d + afebc9d commit 789647e
Show file tree
Hide file tree
Showing 13 changed files with 351 additions and 614 deletions.
4 changes: 2 additions & 2 deletions docs/composing_search_conditions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Creating a FieldSet
-------------------

Before you can compose a SearchCondition you first need a FieldSet configuration,
even when using the Condition ony for exporting you need a FieldSet as the exporter
even when using the Condition only for exporting you need a FieldSet as the exporter
needs to know which data transformer(s) to use.

.. include:: fieldset.rst.inc
Expand All @@ -18,7 +18,7 @@ And now you can use the FieldSet for the SearchConditionBuilder, note that
values must be provided in the "model" format of the field-type.

For the DateTimeType this is a ``DateTime`` object, for the id this is an
``integer``, and username is simply a ``string``.
``integer``, and username is a ``string``.

For this example we want to search for users:

Expand Down
2 changes: 1 addition & 1 deletion docs/creating_reusable_fieldsets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ section for details.*
Depending the implementation of the ``FieldSetRegistry``
the configurator is only constructed once.

The ``LazyFieldSetRegistry`` supports a PSR-11 compatible Container
The ``LazyFieldSetRegistry`` supports a PSR-11 compatible Container.
2 changes: 1 addition & 1 deletion docs/fieldset.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ and then later map these fields to a (table) column.

A FieldSet can be used for any data system or storage, if the FieldSet was
aware of your data system it would be only possible for one storage.
And switching to ElasticSearch from Doctrine ORM would be more difficult.
And switching to ElasticSearch from Doctrine would be more difficult.

.. code-block:: php
:linenos:
Expand Down
21 changes: 21 additions & 0 deletions docs/fieldset_registry.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FieldSetRegistry
----------------

A FieldSetRegistry (:class:`Rollerworks\\Component\\Search\\FieldSetRegistry`)
allows to load a :ref:`FieldSet <fieldset>` from a registry.

The default :class:`Rollerworks\\Component\\Search\\LazyFieldSetRegistry` allows
to load a FieldSet using the FQCN of a FieldSetConfigurator or by using
a `PSR-11`_ compatible container.

.. code-block:: php
use Rollerworks\Component\Search\LazyFieldSetRegistry;
$container = ...;
$registry = new LazyFieldSetRegistry($container, ['fieldset-name' => 'service-id']);
The FieldSetRegistry is amongst used when unserializing a serialized SearchCondition,
so that you don't have to inject the FieldSet explicitly.

.. _`PSR-11`: http://www.php-fig.org/psr/psr-11/
13 changes: 3 additions & 10 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
RollerworksSearch
=================

.. note::

You are reading the documentation for RollerworksSearch 2.x.
Switch to the documentation for RollerworksSearch `1.x`_.

Welcome to RollerworksSearch, RollerworksSearch is a powerful search-system
for PHP. Created to make searching in a PHP powered application as simple and
fast as possible.
RollerworksSearch is a powerful search-system for PHP. Created to make
searching in a PHP powered application as simple and fast as possible.

In this manual you find everything to get started and make the most
of the library. Start by :doc:`learning the basic terms <introduction>`,
then with :doc:`install RollerworksSearch <installing>`, follow-up with
then :doc:`install RollerworksSearch <installing>`, follow-up with
:doc:`processing_searches` and continue with integration extensions
for your framework of choice.

Expand Down Expand Up @@ -50,5 +44,4 @@ Integrations
integration/symfony_bundle
integration/symfony_validator

.. _`1.x`: http://rollerworkssearch.readthedocs.io/en/1.x/
.. _`RollerworksSearch Gitter Channel`: https://gitter.im/rollerworks/RollerworksSearch
31 changes: 0 additions & 31 deletions docs/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,6 @@ in the reference section of this manual.
This chapter explains how you use the processors and how you configure
them to limit the conditions allowed complexity.

Loading processors
------------------

Instead of constructing the processors yourself it's best to lazily load
them using the ``InputProcessorLoader``, which allows to safely load
processors by format::

use Rollerworks\Component\Search\Loader\InputProcessorLoader;

$inputProcessorLoader = InputProcessorLoader::create();
$inputProcessor = $inputProcessorLoader->get('xml');

/* ... */

// The create() method will register all build-in processors.
// But you can also use a PSR-11 compatible Container.

// \Psr\Container\ContainerInterface
$container = ...;

$formatToServiceId = [
'array' => 'rollerworks_search.input.array',
'json' => 'rollerworks_search.input.json',
'xml' => 'rollerworks_search.input.xml',
'string_query' => 'rollerworks_search.input.string_query',
];

$inputProcessorLoader = new InputProcessorLoader($container, $formatToServiceId);

Values limit
------------

Expand Down Expand Up @@ -85,6 +56,4 @@ Input format reference
:maxdepth: 1

reference/input/string_query
reference/input/array
reference/input/json
reference/input/xml
74 changes: 49 additions & 25 deletions docs/installing.rst
Original file line number Diff line number Diff line change
@@ -1,48 +1,72 @@
Installing the Library
======================

Installing RollerworksSearch is trivial. By using Composer to install
the dependencies you don't have to worry about compatibility or autoloading.
.. note::

`Composer`_ is a dependency management library for PHP, which you can use
to download the RollerworksSearch library, and at your choice any extensions.
RollerworksSearch is developed in a monolith repository,
split into smaller components, which follow the same release
cycle and versioning.

Start by `downloading Composer`_ anywhere onto your local computer.
And install RollerworksSearch with Composer by running the following:
RollerworksSearch v1.0 is no longer maintained.

.. code-block:: bash
If you're starting a new project (or already have a project) that will use
one or more components, the easiest way to integrate everything is with `Composer`_.
Composer is smart enough to download the component(s) that you need and take
care of autoloading so that you can begin using the libraries immediately.

$ php composer.phar require "rollerworks/search:^2.0"
This article will take you through using the core component, though
this applies to using any component.

From the directory where your ``composer.json`` file is located.
**1.** If you're creating a new project, create a new empty directory for it.

Now, Composer will automatically download all the required files, and install them
for you. After this you can start integrating RollerworksSearch with your application.
**2.** Open a terminal and use Composer to grab the library.

.. note::
.. code-block:: terminal
All code examples assume you are using the class auto-loader provided by Composer.
$ composer require "rollerworks/search:^2.0"
.. code-block:: php
The name ``rollerworks/search`` is written at the top of the documentation for
whatever component you want.

require 'vendor/autoload.php';
.. tip::

// ...
`Install Composer`_ if you don't have it already present on your system.
Depending on how you install, you may end up with a ``composer.phar``
file in your directory. In that case, no worries! Your command line in that
case is ``php composer.phar require "rollerworks/search:^2.0"``.

When using a Framework integration this is already the case, so don't worry
about this step.

.. caution::
**3.** Write your code!

RollerworksSearch v2.0 is not stable yet! Use with caution. However
RollerworksSearch v1.0 is no longer maintained.
Once Composer has downloaded the component(s), all you need to do is include
the ``vendor/autoload.php`` file that was generated by Composer. This file
takes care of autoloading all of the libraries so that you can use them
immediately::

// File example: src/search.php

// update this to the path to the "vendor/"
// directory, relative to this file
require_once __DIR__.'/../vendor/autoload.php';

use Rollerworks\Component\Search\Searches;

$searchFactory = Searches::createSearchFactory();
$userFieldSetBuilder = $searchFactory->createFieldSetBuilder();

// ...

.. note::

When using a Framework integration the autoloading is already
set-up by your framework bootstrapping.

Extensions
----------

The ``rollerworks/search`` core library itself does not provide any mechanise
for searching in a storage engine (like Doctrine or Elasticsearch). Instead they
are provided as separate extensions you can install.
are provided as separate libraries, called extensions.

Framework integration libraries (provided by Rollerworks) are designed to provide
a clear-cut and ready to use solution. Whenever you install an addition extension,
Expand All @@ -51,7 +75,7 @@ the integration automatically enables the support for it.
.. note::

Only extensions provided by Rollerworks are fully integrated, for extensions
provided by third party developers you may need to enable these manually.
provided by third party developers you may need to enable some things manually.

Framework integration
---------------------
Expand All @@ -69,5 +93,5 @@ Further reading
* :doc:`Using the SearchProcessor <processing_searches>`
* :doc:`Composing SearchConditions <composing_search_conditions>`

.. _`Composer`: http://getcomposer.org/
.. _`downloading Composer`: https://getcomposer.org/download/
.. _Composer: https://getcomposer.org
.. _Install Composer: https://getcomposer.org/download/

0 comments on commit 789647e

Please sign in to comment.