FriendsOfSymfony / FOSElasticaBundle

Elasticsearch PHP integration for your Symfony project using Elastica.
http://friendsofsymfony.github.io
MIT License
1.25k stars 787 forks source link

geo_point configuration doesn't work #604

Closed sloba88 closed 10 years ago

sloba88 commented 10 years ago

It works in some previous commits, if I get some time I will try to do more research.

pin: { type: geo_point }

It doesn't work at all, it parses field as a string.

maxpowel commented 10 years ago

I have the same problem, some days ago it worked perfectly

dylanschoenmakers commented 10 years ago

Well, I also have the same problem. Also worked a few weeks ago.

asennoussi commented 10 years ago

Same here , and the problem is in the Geo_Filter

merk commented 10 years ago

For anyone who has been having problems with mappings not being applied properly with population or reset commands, I have just pushed a development branch that contains a fix.

Please test it out by changing your composer constraint to "friendsofsymfony/elastica-bundle": "dev-typed-config" and seeing if your reset/populate commands now work properly.

I would appreciate any feedback about issues with this code before merging it (especially since it is quite a significant change!)

merk commented 10 years ago

It is likely I've broken something else we dont have test coverage for though - so any feedback about breakages would be appreciated.

asennoussi commented 10 years ago

Count me in , I'll test it once i'm home !

dylanschoenmakers commented 10 years ago

@merk I get an error saying The service "fos_elastica.object_persister.search.content" has a dependency on a non-existent service "fos_elastica.index.search.content.serializer.callback".. Any idea?

merk commented 10 years ago

@dylanschoenmakers you're using the serializer?

Can you please paste your elastica configuration?

dylanschoenmakers commented 10 years ago

@merk Yes, this is my config:

fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }
    indexes:
        search:
            index_name: search_dev
            settings:
                index:
                    analysis:
                        analyzer:
                            ft_analyzer:
                                tokenizer: "nGram"
                                filter:  ["lowercase", "snowball"]
                        filter:
                            snowball:
                                type: "snowball"
                                language: "English"
            types:
                content:
                    mappings:
                        title: { boost: 10, analyzer: ft_analyzer }
                        location: { type: geo_point }

                        pivotedAttributes.kinds: { type: string, index: not_analyzed }
                        pivotedAttributes.types: { type: string, index: not_analyzed }
                        pivotedAttributes.address.city: { type: string, index: not_analyzed }
                    serializer:
                        groups: [elastica, Default]
                    persistence:
                        # the driver can be orm, mongodb or propel
                        # listener and finder are not supported by
                        # propel and should be removed
                        driver: orm
                        model: Opifer\CmsBundle\Entity\Content
                        provider: ~
                        listener:
                            insert: true
                            update: true
                            delete: true
                        finder: ~
                        elastica_to_model_transformer:
                            query_builder_method: createValuedQueryBuilder
    serializer: ~

I am using the JMS Serializer.

merk commented 10 years ago

I've just pushed a new commit that fixes the serializer. Can you test again please?

dTHQb commented 10 years ago

@merk when I tried to switch Elastica from "3.0.*@dev" to "dev-typed-config" it updates composer and then the following happens.

Updating dependencies (including require-dev)

Writing lock file Generating autoload files Compiling component files Updating the "app/config/parameters.yml" file PHP Notice: Undefined index: index_name in /var/www/MetChips/vendor/friendsofsymfony/elastica-bundle/DependencyInjection/FOSElasticaExtension.php on line 133 PHP Stack trace: PHP 1. {main}() /var/www/MetChips/app/console:0 PHP 2. Symfony\Component\Console\Application->run() /var/www/MetChips/app/console:27 PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/MetChips/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121 PHP 4. Symfony\Component\HttpKernel\Kernel->boot() /var/www/MetChips/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70 PHP 5. Symfony\Component\HttpKernel\Kernel->initializeContainer() /var/www/MetChips/app/bootstrap.php.cache:2213 PHP 6. Symfony\Component\DependencyInjection\ContainerBuilder->compile() /var/www/MetChips/app/bootstrap.php.cache:2434 PHP 7. Symfony\Component\DependencyInjection\Compiler\Compiler->compile() /var/www/MetChips/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:617 PHP 8. Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process() /var/www/MetChips/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:118 PHP 9. Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process() /var/www/MetChips/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php:39 PHP 10. FOS\ElasticaBundle\DependencyInjection\FOSElasticaExtension->load() /var/www/MetChips/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php:50 PHP 11. FOS\ElasticaBundle\DependencyInjection\FOSElasticaExtension->loadIndexes() /var/www/MetChips/vendor/friendsofsymfony/elastica-bundle/DependencyInjection/FOSElasticaExtension.php:72

[Symfony\Component\DependencyInjection\Exception\RuntimeException]
The definition for "5532029716b87110ecdb077bbfcd28a0_2" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception

[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

Can you please advise?

merk commented 10 years ago

Can you please paste your fos_elastica config?

dTHQb commented 10 years ago
fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }
    #serializer: 
        #serializer: serializer
    indexes:
        website:
            client: default
            settings:
                index:
                    analysis:
                        analyzer:
                            text_analyzer:
                                type: custom
                                tokenizer: lowercase
                                filter: [text_ngram]
                        filter:
                            text_ngram:
                                type: "nGram"
                                min_gram: 3
                                max_gram: 10
            types:
                rfq:
                    mappings:
                        location:
                            type: object
                            properties:
                                pin: { type: geo_point, lat_lon: true }
dylanschoenmakers commented 10 years ago

@merk the error is gone, but the geo_point mapping is still not working

Scratch that, it is working! Checked out the master instead op typed-config by accident. Thanks.

Now if only #544 for aggregations could get pulled I'd be one happy camper.

merk commented 10 years ago

This should now be fixed in 3.0.0-alpha6, just released.

Please update FOSElasticaBundle and test in your own environments and report anything out of the ordinary.

maxpowel commented 10 years ago

It also works for me, thank you!