1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-16 04:10:09 -07:00

Setup ElasticSearch

This commit is contained in:
David Hübner 2017-05-17 20:14:57 +02:00
parent 8528817e0b
commit 1c39cc1f81
10 changed files with 1711 additions and 1576 deletions

View File

@ -20,8 +20,8 @@ class AppKernel extends Kernel
new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Oneup\FlysystemBundle\OneupFlysystemBundle(), new Oneup\FlysystemBundle\OneupFlysystemBundle(),
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(),
new Liip\ImagineBundle\LiipImagineBundle(), new Liip\ImagineBundle\LiipImagineBundle(),
new FOS\ElasticaBundle\FOSElasticaBundle()
]; ];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {

View File

@ -2,6 +2,8 @@ imports:
- { resource: parameters.yml } - { resource: parameters.yml }
- { resource: security.yml } - { resource: security.yml }
- { resource: services.yml } - { resource: services.yml }
- { resource: config/fos_elastica.yml }
- { resource: config/liip_imagine.yml }
# Put parameters here that don't need to change on each machine where the app is deployed # Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
@ -42,7 +44,7 @@ framework:
twig: twig:
debug: "%kernel.debug%" debug: "%kernel.debug%"
strict_variables: "%kernel.debug%" strict_variables: "%kernel.debug%"
form_themes: ['form/semantic-ui.html.twig', 'LexikFormFilterBundle:Form:form_div_layout.html.twig'] form_themes: ['form/semantic-ui.html.twig', 'form/search.html.twig']
# Doctrine Configuration # Doctrine Configuration
doctrine: doctrine:
@ -74,14 +76,6 @@ doctrine_migrations:
table_name: migration_versions table_name: migration_versions
name: Application Migrations name: Application Migrations
## Swiftmailer Configuration
#swiftmailer:
# transport: "%mailer_transport%"
# host: "%mailer_host%"
# username: "%mailer_user%"
# password: "%mailer_password%"
# spool: { type: memory }
monolog: monolog:
channels: ['loader'] channels: ['loader']
handlers: handlers:
@ -109,40 +103,6 @@ knp_paginator:
pagination: :pagination:knp_pagination.html.twig pagination: :pagination:knp_pagination.html.twig
sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template
liip_imagine:
resolvers:
default:
web_path: ~
filter_sets:
set_min:
quality: 80
data_loader: set_image_loader
cache: ~
filters:
thumbnail: { size: [200, 200], mode: inset }
background: { size: [250, 250], position: center, color: '#FFFFFF' }
set_large:
data_loader: set_image_loader
cache: ~
quality: 92
filters:
thumbnail: { size: [840, 580], mode: inset }
background: { size: [900, 600], position: center, color: '#FFFFFF' }
part_large:
data_loader: part_image_loader
cache: ~
quality: 92
filters:
thumbnail: { size: [840, 580], mode: inset }
background: { size: [900, 600], position: center, color: '#FFFFFF' }
part_min:
quality: 80
data_loader: part_image_loader
cache: ~
filters:
thumbnail: { size: [200, 200], mode: inset }
background: { size: [250, 250], position: center, color: '#FFFFFF' }
oneup_flysystem: oneup_flysystem:
adapters: adapters:
media: media:

View File

@ -0,0 +1,47 @@
fos_elastica:
clients:
default: { host: '%elastica_host%', port: '%elastica_port%', logger: false }
indexes:
app:
index_name: app_%kernel.environment%
types:
set:
mappings:
id: ~
name: { type: string }
year: { type: integer }
partCount: { type: integer }
theme:
type: "object"
properties:
id: ~
name: { type: string }
persistence:
driver: orm
model: AppBundle\Entity\Rebrickable\Set
provider: ~
finder: ~
repository: AppBundle\Repository\Search\SetRepository
model:
mappings:
id: ~
name: { type: string }
aliases:
type: "object"
properties:
id: ~
category:
type: "object"
properties:
id: ~
name: { type: string }
keywords:
type: "object"
properties:
name: ~
persistence:
driver: orm
model: AppBundle\Entity\LDraw\Model
provider: ~
finder: ~
repository: AppBundle\Repository\Search\ModelRepository

View File

@ -0,0 +1,38 @@
liip_imagine:
resolvers:
default:
web_path: ~
filter_sets:
set_min:
quality: 90
data_loader: set_image_loader
cache: ~
default_image: "/resources/images/noimage_min.png"
filters:
thumbnail: { size: [200, 200], mode: inset }
background: { size: [250, 250], position: center, color: '#FFFFFF' }
set_large:
data_loader: set_image_loader
cache: ~
quality: 90
default_image: "/resources/images/noimage_large.png"
filters:
thumbnail: { size: [840, 580], mode: inset }
background: { size: [900, 600], position: center, color: '#FFFFFF' }
part_min:
quality: 90
data_loader: part_image_loader
cache: ~
default_image: "/resources/images/noimage_min.png"
filters:
thumbnail: { size: [200, 200], mode: inset }
background: { size: [250, 250], position: center, color: '#FFFFFF' }
part_large:
data_loader: part_image_loader
cache: ~
quality: 90
default_image: "/resources/images/noimage_large.png"
filters:
thumbnail: { size: [840, 580], mode: inset }
background: { size: [900, 600], position: center, color: '#FFFFFF' }

View File

@ -10,6 +10,10 @@ parameters:
# You should uncomment this if you want use pdo_sqlite # You should uncomment this if you want use pdo_sqlite
# database_path: "%kernel.root_dir%/data.db3" # database_path: "%kernel.root_dir%/data.db3"
# https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started.html
elastica_host : localhost
elastica_port : 9200
# A secret key that's used to generate certain security-related tokens # A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt secret: ThisTokenIsNotSoSecretChangeIt

View File

@ -1,20 +1,21 @@
services: services:
form.filter.category:
class: AppBundle\Form\Filter\Model\CategoryFilterType
arguments:
- '@repository.ldraw.category'
tags:
- { name: form.type }
form.filter.brickset: form.filter.brickset:
class: AppBundle\Form\FilterSetType class: AppBundle\Form\FilterSetType
arguments: ['@api.manager.brickset'] arguments: ['@api.manager.brickset']
tags: tags:
- { name: form.type } - { name: form.type }
form.filter.theme: form.search.model:
class: AppBundle\Form\Filter\Set\ThemeFilterType class: AppBundle\Form\Search\ModelSearchType
arguments: arguments:
- '@repository.rebrickable.theme' - '@repository.ldraw.category'
tags:
- { name: form.type }
form.search.set:
class: AppBundle\Form\Search\SetSearchType
arguments:
- '@repository.rebrickable.theme'
- '@repository.rebrickable.set'
tags: tags:
- { name: form.type } - { name: form.type }

View File

@ -25,10 +25,10 @@
"incenteev/composer-parameter-handler": "^2.0", "incenteev/composer-parameter-handler": "^2.0",
"guzzlehttp/guzzle": "^6.2", "guzzlehttp/guzzle": "^6.2",
"knplabs/knp-menu-bundle": "^2.1", "knplabs/knp-menu-bundle": "^2.1",
"oneup/flysystem-bundle": "^1.7",
"knplabs/knp-paginator-bundle": "^2.5", "knplabs/knp-paginator-bundle": "^2.5",
"lexik/form-filter-bundle": "~5.0", "oneup/flysystem-bundle": "^1.7",
"liip/imagine-bundle": "^1.7" "liip/imagine-bundle": "^1.7",
"friendsofsymfony/elastica-bundle": "^4.0"
}, },
"require-dev": { "require-dev": {
"sensio/generator-bundle": "^3.0", "sensio/generator-bundle": "^3.0",

3115
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -633,12 +633,6 @@ class SymfonyRequirements extends RequirementCollection
'Install and enable the <strong>mbstring</strong> extension.' 'Install and enable the <strong>mbstring</strong> extension.'
); );
$this->addRecommendation(
function_exists('iconv'),
'iconv() should be available',
'Install and enable the <strong>iconv</strong> extension.'
);
$this->addRecommendation( $this->addRecommendation(
function_exists('utf8_decode'), function_exists('utf8_decode'),
'utf8_decode() should be available', 'utf8_decode() should be available',

View File

@ -11,7 +11,7 @@
*/ */
if (!isset($_SERVER['HTTP_HOST'])) { if (!isset($_SERVER['HTTP_HOST'])) {
exit('This script cannot be run from the CLI. Run it from a browser.'); exit("This script cannot be run from the CLI. Run it from a browser.\n");
} }
if (!in_array(@$_SERVER['REMOTE_ADDR'], array( if (!in_array(@$_SERVER['REMOTE_ADDR'], array(