コード例 #1
0
 /**
  * Update solr index for commercialVehicle
  *
  * @param object  $commercialVehicle commercialVehicle object
  *
  * @return void
  */
 public function updateSolrIndex($commercialVehicle, $isBatchCommit = false)
 {
     $ad = $commercialVehicle->getAd();
     $doc = $this->adSolrIndexService->updateSolrIndex($ad);
     $equipments = array();
     if ($commercialVehicle->getMileage()) {
         $doc->mileage_i = $commercialVehicle->getMileage();
     }
     if ($commercialVehicle->getConditions()) {
         $doc->conditions_i = $commercialVehicle->getConditions()->getId();
     }
     if ($commercialVehicle->getCommercialVehicleType()) {
         $doc->commercialVehicleType_i = $commercialVehicle->getCommercialVehicleType() ? $commercialVehicle->getCommercialVehicleType()->getId() : 0;
     }
     if ($commercialVehicle->getColor()) {
         $doc->color_i = $commercialVehicle->getColor() ? $commercialVehicle->getColor()->getId() : 0;
     }
     if ($commercialVehicle->getFuelType()) {
         $doc->fuelType_i = $commercialVehicle->getFuelType() ? $commercialVehicle->getFuelType()->getId() : 0;
     }
     if ($commercialVehicle->getCapacity()) {
         $doc->capacity_i = $commercialVehicle->getCapacity() ? $commercialVehicle->getCapacity()->getId() : 0;
     }
     if ($commercialVehicle->getOwners()) {
         $doc->owners_i = $commercialVehicle->getOwners() ? $commercialVehicle->getOwners()->getId() : 0;
     }
     if ($commercialVehicle->getMfgYear()) {
         $doc->mfgYear_i = $commercialVehicle->getMfgYear();
     }
     if ($commercialVehicle->getSalvage()) {
         $doc->salvage_i = $commercialVehicle->getSalvage() ? $commercialVehicle->getSalvage()->getId() : 0;
     }
     if ($commercialVehicle->getFuelConsumption()) {
         $doc->fuelConsumption_s = $commercialVehicle->getFuelConsumption();
     }
     if ($commercialVehicle->getVin()) {
         $doc->vin_i = $commercialVehicle->getVin();
     }
     if ($commercialVehicle->getPower()) {
         $doc->power_d = $commercialVehicle->getPower();
     }
     if ($commercialVehicle->getModel()) {
         $doc->model_s = $commercialVehicle->getModel();
     }
     if ($commercialVehicle->getCommercialVehicleEquipment()) {
         foreach ($commercialVehicle->getCommercialVehicleEquipment() as $equipment) {
             $equipments[] = $equipment ? $equipment->getId() : 0;
         }
     }
     if (count($equipments)) {
         $doc->commercialVehicleEquipment_is = array_unique($equipments);
     }
     // this executes the query and returns the result
     return $this->adSolrIndexService->commit($doc, $isBatchCommit);
 }
コード例 #2
0
 /**
  * Update solr index for machine
  *
  * @param object  $machine machine object
  *
  * @return void
  */
 public function updateSolrIndex($machine, $isBatchCommit = false)
 {
     $ad = $machine->getAd();
     $doc = $this->adSolrIndexService->updateSolrIndex($ad);
     if ($machine->getMileage()) {
         $doc->mileage_i = $machine->getMileage();
     }
     if ($machine->getConditions()) {
         $doc->conditions_i = $machine->getConditions()->getId();
     }
     if ($machine->getColor()) {
         $doc->color_i = $machine->getColor() ? $machine->getColor()->getId() : 0;
     }
     if ($machine->getFuelType()) {
         $doc->fuelType_i = $machine->getFuelType() ? $machine->getFuelType()->getId() : 0;
     }
     if ($machine->getCapacity()) {
         $doc->capacity_i = $machine->getCapacity() ? $machine->getCapacity()->getId() : 0;
     }
     if ($machine->getOwners()) {
         $doc->owners_i = $machine->getOwners() ? $machine->getOwners()->getId() : 0;
     }
     if ($machine->getMfgYear()) {
         $doc->mfgYear_i = $machine->getMfgYear();
     }
     if ($machine->getSalvage()) {
         $doc->salvage_i = $machine->getSalvage() ? $machine->getSalvage()->getId() : 0;
     }
     if ($machine->getFuelConsumption()) {
         $doc->fuelConsumption_s = $machine->getFuelConsumption();
     }
     if ($machine->getVin()) {
         $doc->vin_i = $machine->getVin();
     }
     if ($machine->getPower()) {
         $doc->power_d = $machine->getPower();
     }
     if ($machine->getMachineMake()) {
         $doc->machineMake_i = $machine->getMachineMake() ? $machine->getMachineMake()->getId() : 0;
     }
     if ($machine->getModel()) {
         $doc->model_s = $machine->getModel();
     }
     // this executes the query and returns the result
     return $this->adSolrIndexService->commit($doc, $isBatchCommit);
 }
コード例 #3
0
 /**
  * Update solr index for car
  *
  * @param object  $car car object
  *
  * @return void
  */
 public function updateSolrIndex($car, $isBatchCommit = false)
 {
     $ad = $car->getAd();
     $doc = $this->adSolrIndexService->updateSolrIndex($ad);
     if ($car->getMileage()) {
         $doc->mileage_i = $car->getMileage();
     }
     if ($car->getEngineSize()) {
         $doc->engineSize_i = $car->getEngineSize();
     }
     if ($car->getDoors()) {
         $doc->doors_i = $car->getDoors();
     }
     if ($car->getConditions()) {
         $doc->conditions_i = $car->getConditions()->getId();
     }
     if ($car->getColor()) {
         $doc->color_i = $car->getColor() ? $car->getColor()->getId() : 0;
     }
     if ($car->getFuelType()) {
         $doc->fuelType_i = $car->getFuelType() ? $car->getFuelType()->getId() : 0;
     }
     if ($car->getCapacity()) {
         $doc->capacity_i = $car->getCapacity() ? $car->getCapacity()->getId() : 0;
     }
     if ($car->getTuvValidity()) {
         $doc->tuvValidity_i = $car->getTuvValidity() ? $car->getTuvValidity()->getId() : 0;
     }
     if ($car->getTransmission()) {
         $doc->transmission_i = $car->getTransmission() ? $car->getTransmission()->getId() : 0;
     }
     if ($car->getGearType()) {
         $doc->gearType_i = $car->getGearType() ? $car->getGearType()->getId() : 0;
     }
     if ($car->getEmission()) {
         $doc->emission_i = $car->getEmission() ? $car->getEmission()->getId() : 0;
     }
     if ($car->getAirConditioner()) {
         $doc->airConditioner_i = $car->getAirConditioner() ? $car->getAirConditioner()->getId() : 0;
     }
     if ($car->getCarType()) {
         $doc->carType_i = $car->getCarType() ? $car->getCarType()->getId() : 0;
     }
     if ($car->getOwners()) {
         $doc->owners_i = $car->getOwners() ? $car->getOwners()->getId() : 0;
     }
     if ($car->getSeats()) {
         $doc->seats_i = $car->getSeats();
     }
     if ($car->getMfgYear()) {
         $doc->mfgYear_i = $car->getMfgYear();
     }
     if ($car->getSalvage()) {
         $doc->salvage_i = $car->getSalvage() ? $car->getSalvage()->getId() : 0;
     }
     if ($car->getFuelConsumption()) {
         $doc->fuelConsumption_s = $car->getFuelConsumption();
     }
     if ($car->getDisplacement()) {
         $doc->displacement_d = $car->getDisplacement();
     }
     if ($car->getVin()) {
         $doc->vin_i = $car->getVin();
     }
     if ($car->getPower()) {
         $doc->power_d = $car->getPower();
     }
     $equipments = array();
     if ($car->getCarEquipments()) {
         foreach ($car->getCarEquipments() as $equipment) {
             $equipments[] = $equipment ? $equipment->getId() : 0;
         }
     }
     if (count($equipments)) {
         $doc->carEquipment_is = array_unique($equipments);
     }
     // this executes the query and returns the result
     return $this->adSolrIndexService->commit($doc, $isBatchCommit);
 }