class NodeSourceSearchHandler extends AbstractSearchHandler (View source)

Class NodeSourceSearchHandler

Properties

protected $client from AbstractSearchHandler
protected $em from AbstractSearchHandler
protected $logger from AbstractSearchHandler

Methods

__construct(Client $client, EntityManager $em, LoggerInterface $logger = null)

No description

string
getDocumentType()

No description

array|null
parseSolrResponse($response)

No description

mixed
argFqProcess($args)

No description

array
nativeSearch(string $q, array $args = [], integer $rows = 20, boolean $searchTags = false, integer $proximity = 10000000, integer $page = 1)

No description

int
parseResultCount(array $response)

No description

array
searchWithHighlight(string $q, array $args = [], int $rows = 20, boolean $searchTags = false, int $proximity = 10000000, int $page = 1)

Search on Solr with pre-filled argument for highlighting

array
search(string $q, array $args = [], int $rows = 20, boolean $searchTags = false, int $proximity = 10000000, int $page = 1)

Search on Solr.

int
count($q, array $args = [], int $rows, bool $searchTags = false, int $proximity = 10000000)

No description

string
buildQuery(string $q, array $args, bool $searchTags, int $proximity)

Default Solr query builder.

Details

__construct(Client $client, EntityManager $em, LoggerInterface $logger = null)

Parameters

Client $client
EntityManager $em
LoggerInterface $logger

protected string getDocumentType()

Return Value

string

protected array|null parseSolrResponse($response)

Parameters

$response

Return Value

array|null

protected mixed argFqProcess($args)

Parameters

$args

Return Value

mixed

protected array nativeSearch(string $q, array $args = [], integer $rows = 20, boolean $searchTags = false, integer $proximity = 10000000, integer $page = 1)

Parameters

string $q
array $args
integer $rows
boolean $searchTags
integer $proximity Proximity matching: Lucene supports finding words are a within a specific distance away.
integer $page

Return Value

array

protected int parseResultCount(array $response)

Parameters

array $response

Return Value

int

array searchWithHighlight(string $q, array $args = [], int $rows = 20, boolean $searchTags = false, int $proximity = 10000000, int $page = 1)

Search on Solr with pre-filled argument for highlighting

  • $q is the search criteria.
  • $args is a array with solr query argument. The common argument can be found here and for highlighting argument is here.

Parameters

string $q
array $args
int $rows
boolean $searchTags Search in tags/folders too, even if a node don’t match
int $proximity Proximity matching: Lucene supports finding words are a within a specific distance away.
int $page

Return Value

array Return a array of tuple for each result. [document, highlighting] for Documents and [nodeSource, highlighting]

Search on Solr.

  • $q is the search criteria.
  • $args is a array with solr query argument. The common argument can be found here and for highlighting argument is here.

You can use shortcuts in $args array to filter:

For node-sources:

  • status (int)
  • visible (boolean)
  • nodeType (RZ\Roadiz\Core\Entities\NodeType or string or array)
  • tags (RZ\Roadiz\Core\Entities\Tag or array of Tag)
  • translation (RZ\Roadiz\Core\Entities\Translation)

For other filters, use $args['fq'][] array, eg.

$args["fq"][] = "title:My title";

this explicitly filter by title.

Parameters

string $q
array $args
int $rows Results per page
boolean $searchTags Search in tags/folders too, even if a node don’t match
int $proximity Proximity matching: Lucene supports finding words are a within a specific distance away. Default 10000000
int $page Retrieve a specific page

Return Value

array Return an array of doctrine Entities (Document, NodesSources)

int count($q, array $args = [], int $rows, bool $searchTags = false, int $proximity = 10000000)

Parameters

$q
array $args
int $rows Useless var but keep it for retrocompatibility
bool $searchTags
int $proximity Proximity matching: Lucene supports finding words are a within a specific distance away. Default 10000000

Return Value

int

protected string buildQuery(string $q, array $args, bool $searchTags, int $proximity)

Default Solr query builder.

Extends this method to customize your Solr queries. Eg. to boost custom fields.

Parameters

string $q
array $args
bool $searchTags
int $proximity

Return Value

string