| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.dao.HomeNoticeDao; |
| | | import com.yeshi.buwan.domain.HomeNotice; |
| | | import com.yeshi.buwan.domain.SolrVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.dao.video.AlbumVideoMapDao; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.dto.search.SolrResultDTO; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.manager.SolrAlbumDataManager; |
| | | import com.yeshi.buwan.service.inter.juhe.AlbumVideoMapService; |
| | | import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.SolrCommonVideoDataManager; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | public class SolrTest { |
| | | |
| | | @Resource |
| | | private SolrAlbumDataManager solrDataManager; |
| | | private SolrAlbumVideoDataManager solrDataManager; |
| | | |
| | | @Resource |
| | | private SolrCommonVideoDataManager solrCommonVideoDataManager; |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | | @Resource |
| | | private HomeNoticeDao homeNoticeDao; |
| | | @Resource |
| | | private AlbumVideoMapService albumVideoMapService; |
| | | |
| | | @Test |
| | | public void test1() { |
| | | SolrVideoSearchFilter filter = new SolrVideoSearchFilter(); |
| | | filter.setKey("吉他"); |
| | | filter.setKey(""); |
| | | filter.setVideoType(null); |
| | | filter.setContentType(1); |
| | | filter.setResourceIds(new String[]{"24"}); |
| | | // filter.setResourceIds(new String[]{"24"}); |
| | | |
| | | SolrResultDTO dto = solrDataManager.find(filter, 1, 10); |
| | | System.out.println(dto); |
| | |
| | | |
| | | @Test |
| | | public void addSolrAlbum() { |
| | | solrDataManager.syncAlbum("8172667"); |
| | | solrDataManager.syncAllAlbum(); |
| | | System.out.println(); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void syncSolrCommonVideo() { |
| | | // solrCommonVideoDataManager.syncAllVideo(); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private AlbumVideoMapDao albumVideoMapDao; |
| | | |
| | | @Test |
| | | public void test2() { |
| | | solrDataManager.clear(); |
| | | |
| | | for(int i=0;i<100;i++) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("id").type(7)); |
| | | query.limit(100); |
| | | List<AlbumVideoMap> list = albumVideoMapDao.findList(query); |
| | | |
| | | |
| | | for (AlbumVideoMap map : list) { |
| | | AlbumVideoMap newMap = new AlbumVideoMap(); |
| | | newMap.setVideoCount(map.getVideoCount()); |
| | | newMap.setRootVideoType(map.getRootVideoType()); |
| | | newMap.setVideoId(map.getVideoId()); |
| | | newMap.setCreateTime(new Date()); |
| | | newMap.setId(map.getVideoId()); |
| | | albumVideoMapDao.save(newMap); |
| | | albumVideoMapDao.deleteByPrimaryKey(map.getId()); |
| | | } |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |