Download the PHP package lmc/cqrs-solr without Composer
On this page you can find all versions of the php package lmc/cqrs-solr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lmc/cqrs-solr
More information about lmc/cqrs-solr
Files in lmc/cqrs-solr
Package cqrs-solr
Short Description A library containing base implementations to help with Solr Queries and Commands
License MIT
Informations about the package cqrs-solr
LMC CQRS Solr extension
A library containing base implementations to help with Solr Queries and Commands. This library is an extension for CQRS/Bundle and adds support for
Solarium
requests.
Table of contents
- Installation
- Queries
- Query
- Query Handlers
- Commands
- Send Command Handlers
- Command
- Response Decoders
- Profiler Formatters
- Value Objects
- Query Builder
Installation
NOTE: It also requires Solarium and Solarium bundle, which are directly required by this library.
Query
Query is a request which fetch a data without changing anything. See more here
It is allowed and recommended to use a InjectSolrClientInterface
with a Solr queries, so you don't need to worry about a Solarium Client
, you will simply get it automatically.
AbstractSolrQuery
A base Solr Query, it abstracts and predefine some of a most used features with this kind of a Query.
It implements a ProfileableInterface
and CacheableInterface
features.
Method | Type | Description |
---|---|---|
getRequestType |
final | It declares a request type of a query to be a SolrRequest |
createRequest |
abstract | It declares a base QueryInterface method to return a SolrRequest type. |
getRequestUrl |
base | It's a predefined method which creates a request and build a solarium request to return a final url. |
getCacheTime |
base | It returns a default value for a cache time of 30 minutes. |
getCacheKey |
base | It creates a CacheKey out of an Solr endpoint , a static class name (your implementation class name) and a md5 representation of a final url , which should create a unique enough cache key for most queries. |
getProfilerId |
base | It's a predefined creating of profiler id for a Solr query. It creates a profiler id based on a final url . |
getProfilerData |
base | If you overwrite this method, you can specify additional profiler data. Default is null (no data). |
getEndpoint |
base | It returns a Solr endpoint for your Query. |
__toString |
base | It's a predefined casting a Query into string, it returns a string representation of a final url . |
AbstractSolrSelectQuery
A base Solr Select Query, it abstracts and predefine some of a most used features with this kind of a Query.
It extends a base AbstractSolrQuery
and predefine some abstract methods. It also adds InjectSolrClientInterface
feature, since it needs a Solarium Client
to create a Select Request
.
Method | Type | Description |
---|---|---|
setOffset |
base | It simply sets an offset (where should select start) for a Solr select request. |
setLimit |
base | It simply sets a limit (number of rows) for a Solr select request. |
createRequest |
final | It creates a SolrRequest with a prepared Solarium Select . |
prepareSelect |
abstract | It requires you prepare a Solr select request. What do you actually wants to select - set of fields and other select properties. |
BuilderPrototypeQuery
This is a special type of a SolrSelectQuery
it also extends an AbstractSolrSelectQuery
and implement prepareSelect
method with a usage of QueryBuilder applicators.
It is a Query, which QueryBuilder
creates for you.
Query Handlers
It is responsible for handling a specific Query request and passing a result into OnSuccess
callback. See more here.
Solr Query Handler
This handler supports Lmc\Cqrs\Solr\ValueObject\SolrRequest
(see SolrRequest) and handles it into Solarium\Core\Query\Result\ResultInterface
.
It also prepares a Query implementing a InjectSolrClientInterface
by injecting a Solarium Client
into a Query so it is not required for you to inject a Solarium Client
into a query by yourself.
Value Objects
SolrField
It is a representation of any data passed by user to Solr (eg. in query or a list of fields returned by Solr)
SolrRequest
It is a simple Value object containing an Abstract Solarium Query
and optionally a Solr endpoint
.
Query Builder
Query builder is an abstraction above a Solarium Select Query set up.
The idea is that you have just a data, used in select, stored in an entity. The entity stands for what you want to select and how. And according to interfaces, that this entity implements, the data is passed into a Select Query.
Query Builder builds a CQRS/QueryFetcher with all supported features.
Example
Imagine you need to select 30 Persons
with fields Name
and Age
by search input
, stored in a Solr, you would have something like:
With direct Solarium usage you need to create a Select Query yourself and remember all setters and stuff.
Now Query Builder offers a predefined applicators, which knows how the Select query is built and just need a data for the select query.
Example above using a Query Builder would look something like:
Entity Interface
It is a definition interface for a specific feature set you want a query to have.
Note: It is not a complete set of Solr/Solarium Select features, it is just our most used features.
EntityInterface
- A base interface for all features, which adds a
getFields
andgetNumberOfRows
base methods. |
- A base interface for all features, which adds a
FacetsInterface
FilterInterface
FiltersInterface
FulltextBigramInterface
FulltextBoostInterface
FulltextInterface
GroupingFacetInterface
GroupingInterface
ParameterizedInterface
SortInterface
StatsInterface
Applicators
Applicator is a service which can apply a specific set of data into a Solarium select query based on implemented Interface.
It must implement a ApplicatorInterface
.
You can implement your own applicator if you want to mix features or simply use a feature, which does not have an applicator yet.
ApplicatorInterface
It is an interface, which all applicators must implement. It specifies which Entity is current applicator supporting and it can apply its data into Solarium request. It should be able to skip setting a value, if it is empty.
Applicator Factory
It is a service with all defined applicators, its purpose is to return all applicators supporting a given Entity.
It is used inside a QueryBuilder
to get a list of applicators, which needs to be applied on Select Query.
List of all applicators
EntityApplicator
FacetsApplicator
FilterApplicator
FiltersApplicator
FulltextApplicator
FulltextBigramApplicator
FulltextBoostApplicator
GroupingApplicator
GroupingFacetApplicator
ParameterizedApplicator
SortApplicator
StatsApplicator
All versions of cqrs-solr with dependencies
ext-json Version *
ext-mbstring Version *
lmc/cqrs-types Version ^3.2
nelmio/solarium-bundle Version ^5.0
solarium/solarium Version ^6.2.3