Exercise/FOQElasticaBundle — Issue #57: Search returns nothing
Author: IjinPL
Created: 2011-12-30 11:02:04+00:00
State: open

I got beautifully working Elastica using this bundle. Everything works perfectly, but just befor deploy it stoped returning anything. It always returns null, despite the fact indexes are loaded and I can reload it anytime. My confing is like that:

config.yml

```
foq_elastica:
clients:
default: { host: localhost, port: 9020 }
indexes:
website:
client: default
types:
product:
mappings:
name: { boost: 5 }
subname: { boost: 3 }
sn: { boost: 3 }
doctrine:
driver: orm
model: Cataloger\CatalogBundle\Entity\Product
provider:
finder:
listener:
insert: true
update: false
delete: true
```

Product.class.php

```

namespace Cataloger\CatalogBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity(repositoryClass="Cataloger\CatalogBundle\Repository\ProductRepository")
* @ORM\Table(name="products")
* @ORM\HasLifecycleCallbacks()
*
*/
class Product
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;

/**
* @ORM\Column(type="string")
* @ORM\Column(unique=true)
* @Assert\NotBlank()
*/
protected $name;

/**
* @ORM\Column(type="string")
* @ORM\Column(unique=true)
*/
protected $slug;

/**
* @ORM\Column(type="string")
* @ORM\Column(unique=true)
* @Assert\NotBlank()
*/
protected $sn;

/**
* @ORM\Column(type="string")
* @ORM\Column(nullable=true)
*/
protected $subname;

/**
* @ORM\ManyToOne(targetEntity="Category", cascade={"persist", "remove"})
*/
protected $manufacture;

/**
* @ORM\Column(type="text")
* @ORM\Column(nullable=true)
*/
protected $description;

/**
* @ORM\Column(type="boolean")
* @ORM\Column(nullable=true)
*/
protected $is_new;

/**
* @ORM\Column(type="boolean")
* @ORM\Column(nullable=true)
*/
protected $is_bestseller;

/**
* @ORM\Column(type="datetime")
*/
protected $created;

/**
* @ORM\OneToMany(targetEntity="Photo", mappedBy="refId", cascade={"persist", "remove"})
*/
protected $photos;

/**
* @ORM\ManyToOne(targetEntity="Category", inversedBy="products")
*/
protected $category;

....

}
```

Controller

```
public function searchAction()
{
$request = $this->getRequest();
if($request->isXmlHttpRequest()){

$phrase = $request->request->get('phrase');
$finder = $this->container->get('foq_elastica.finder.website.product');
$products = $finder->find('szczypce', 12);
return $this->render('CatalogerCatalogBundle:Category:search.xml.twig', array('products'=>$products));
}else{
throw $this->createNotFoundException('Not XmlHttpRequest!');
}
}

```

Did i do something wrong? I con not sole this so I'm asking for help.