Closed hanzx closed 8 years ago
Try this:
$query = $this->get('solr.client')->createQuery('AcmeDemoBundle:Post');
$query->addSearchTerm('id', '0000396-1341');
$result = $query->getResult();
i know, i only show you),but my problem is
Hydration mode is HYDRATE_INDEX
class ValueHydrator implements HydratorInterface
{
/**
* {@inheritdoc}
*/
public function hydrate($document, MetaInformationInterface $metaInformation)
{
$targetEntity = $metaInformation->getEntity();
$reflectionClass = new \ReflectionClass($targetEntity);
foreach ($document as $property => $value) {
if ($property === MetaInformationInterface::DOCUMENT_KEY_FIELD_NAME) {
$value = $this->removePrefixedKeyFieldName($value);
}
// skip field if value is array or "flat" object
// hydrated object should contain a list of real entities / entity
if ($this->isComplexValue($property, $value, $metaInformation)) {
continue;
}
return
when i comment isComplexValue
class ValueHydrator implements HydratorInterface
{
/**
* {@inheritdoc}
*/
public function hydrate($document, MetaInformationInterface $metaInformation)
{
$targetEntity = $metaInformation->getEntity();
$reflectionClass = new \ReflectionClass($targetEntity);
foreach ($document as $property => $value) {
if ($property === MetaInformationInterface::DOCUMENT_KEY_FIELD_NAME) {
$value = $this->removePrefixedKeyFieldName($value);
}
// skip field if value is array or "flat" object
// hydrated object should contain a list of real entities / entity
/*if ($this->isComplexValue($property, $value, $metaInformation)) {
continue;
}*/
return this a it is what i need:
What version do you use? This problem should be fixed with 8714d201c20610148453ad9d612822ee70251cd0
last 1.5.4
please try dev-master!
cool- thanks11
Hi Florian,
Symfony profiler -> Solr Queries -> parameters -> omitHeader=true wt=json json.nl=flat q=id:product_0000396-1341 start=0 rows=10 fl=*,score
I need there id:0000396-1341? Thanks