在我们的 symfony2 项目中,我们想用 ongr-io 包实现弹性搜索,但是我们的整个系统是建立在教义上的。是否有可能以某种方式使用 ongr-io elasticsearch 包而不用文档而不是实体完全重做整个数据库?
我要索引的实体(搜索字段为:名称、ChildCategory 和 ParentCategory):
/**
* Course
*
* @ORM\Table(name="course")
* @ORM\Entity(repositoryClass="CoreBundle\Repository\CourseRepository")
* @ORM\HasLifecycleCallbacks
*/
class Course
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, unique=false)
*/
private $name;
/**
* @var ParentCategory
*
* @ORM\ManyToOne(targetEntity="ParentCategory")
* @ORM\JoinColumn(name="parentCategory_id", referencedColumnName="id")
*/
private $parentCategory;
/**
* @var ChildCategory
*
* @ORM\ManyToOne(targetEntity="ChildCategory", inversedBy="courses")
* @ORM\JoinColumn(name="childCategory_id", referencedColumnName="id")
*/
private $childCategory;
/**
* @var City
*
* @ORM\ManyToOne(targetEntity="City")
* @ORM\JoinColumn(name="city_id", referencedColumnName="id")
*/
private $city;
/**
* @var Users
*
* @ORM\ManyToOne(targetEntity="UserBundle\Entity\Users", inversedBy="course")
* @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
*/
private $owner;
/**
* @var text
*
* @ORM\Column(name="description", type="text")
*/
private $description;
/**
* @var Picture
*
* @ORM\OneToMany(targetEntity="CoreBundle\Entity\Picture", mappedBy="course", cascade={"persist", "remove"})
*/
private $pictures;
/**
* @var Ratings
*
* @ORM\OneToMany(targetEntity="CoreBundle\Entity\Ratings", mappedBy="courseid")
*/
private $ratings;
public $avgRating;
}