Using advanced object search elastic search

Hello guys, I installed : https://github.com/pimcore/advanced-object-search
But I have some issues. I created a config file :

return [
    "hosts" => ["142.19.5.8:9200"],
    "index-prefix" => "objectsearch_",
];

I have the error :

 SQLSTATE[42S02]: Base table or view not found: 1146 Table 'project.bundle_advancedobjectsearch_update_queue' doesn't exist

When I do bin/console doctrine:schema:update --force I get :

 [OK] Nothing to update - your database is already in sync with the current entity metadata.                            

Have you an idea about that ? Thx in advance

Hi,
did you install the pimcore bundle?

BR
Christian

I install using pimcore command now, and seems that works fine. I tried to do now the filter :

$service = $this->get("AdvancedObjectSearchBundle\Service");
$service->updateMapping(ClassDefinition::getByName("ProductSupplier"));
 $objects =ProductSupplier::getList();
foreach($objects as $object) {
     $service->doUpdateIndexData($object);
}
$results = $service->doFilter(17,
    [
        new FilterEntry(
                    "objects",
                    [
                        "type" => "object",
                        "id" => 79
                    ],
                    BoolQuery::MUST
                )
            ],
            ""
        );

And I get the error :

 Type error: Argument 1 passed to AdvancedObjectSearchBundle\Service::getFieldDefinitionAdapter() must be an instance of Pimcore\Model\DataObject\ClassDefinition\Data, boolean given

Have you an idea about that @fash ? Thx in advance

Can you please debug a bit further … I also would have to debug…
Thanks.

From what I saw, the problem is in the file/advanced-object-search/src/Service.php :

/**
     * returns field definition adapter for given field definition
     *
     * @param ClassDefinition\Data $fieldDefinition
     * @param bool $considerInheritance
     * @return IFieldDefinitionAdapter
     */
    public function getFieldDefinitionAdapter(ClassDefinition\Data $fieldDefinition, bool $considerInheritance) {
        $adapter = null;

        if ($this->filterLocator->has($fieldDefinition->fieldtype)) {
            $adapter = $this->filterLocator->get($fieldDefinition->fieldtype);
        } else {
            $adapter = $this->filterLocator->get('default');
        }

        $adapter->setConsiderInheritance($considerInheritance);
        $adapter->setFieldDefinition($fieldDefinition);

        return $adapter;
    }

$fieldDefinition in our case is of type FilterEntry. May be I need to change the version of plugin to dev-master ?

Hi,
just tested on dev-master and works fine for me. Latest release is pretty much equal to master, so this should not be the problem.

Is your relation fieldname in ProductSupplier class really objects? Because I get the same error message, when I use a wrong fieldname here.

BR
Christian

Thank you @fash , this is my ProductSupplier class :


How I should modify the FilterEntry in this case ? Thx in advance

$results = $service->doFilter(17,
    [
        new FilterEntry(
                    "products",
                    [
                        "type" => "object",
                        "id" => 79
                    ],
                    BoolQuery::MUST
                )
            ],
            ""
        );

@fash thank you, one more thing to specify please, for this kind of search :

$results = $service->doFilter(17,
            [
                [
                    "fieldname"         => "name",
                    "filterEntryData"   => "nike"
                ],
            ],
            ""
        );

I get also the error : Type error: Argument 1 passed to AdvancedObjectSearchBundle\Service::getFieldDefinitionAdapter() must be an instance of Pimcore\Model\DataObject\ClassDefinition\Data, boolean given

What I’m doing wrong ? The field name exist in the entity

hi Gpim, I noticed that ‘name’ is a localized field in our solution, look at this example from the documentation where ‘en’ should be your language :

[
            "fieldname" => "localizedfields",
            "filterEntryData" => [
                "en" => [
                    "name" => "nike"
                ]
            ]
        ],