英文:
Spring Elasticsearch, create a apps trending request
问题
在我的 Elasticsearch 中,我有一个包含应用程序和游戏类别以及大量元数据的 APK 列表。
我必须按类别返回热门交易 APK 的列表。我的请求必须考虑并按照以下最佳组合进行排序:
- 当前周内下载最多的 APK(应用程序或游戏)
- 评价最积极的
- 评论最多的
请问如何创建这种类型的请求?
我使用的是 Spring 2.2 和 Spring Elasticsearch 3.2.4。
@Data
@NoArgsConstructor
@ToString
@Document(indexName = "apk")
public class Apk {
@Id // 唯一标识符
private Long id;
@Field(type = FieldType.Nested, includeInParent = true)
private Rating rating = new Rating();
@Field(type = FieldType.Nested, includeInParent = true)
private List<Review> userReview = new ArrayList<>();
@Field(type = FieldType.Nested, includeInParent = true)
private Category category;
@Field(type = FieldType.Nested, includeInParent = true)
private SubCategory subCategory;
private ApkStatus status = ApkStatus.INITIATED;
private Set<String> dependencies = new HashSet<>();
private Set<String> permissions = new HashSet<>();
private String changes;
private Long companyId;
private String description;
private String displayName;
private String packageName = "unknown";
private BigDecimal price = new BigDecimal(0);
private String shortDescription;
private String versionName = "unknown";
private String videoUrl;
private Boolean containsAds;
private Boolean isFree = false;
private long versionCode = 0;
private String minSdkVersion;
private String targetSdkVersion;
private String maxSdkVersion;
private long installs;
private long unInstalls;
private long size;
private String apkName;
private String repositoryGeneratedId;
private String iconPath;
private String iconDownloadUrl;
private String apkPath;
private String apkDownloadUrl;
private String installHistoryString;
private String unInstallHistoryString;
@Transient
private NavigableMap<String, Integer> installHistory = new TreeMap<>();
@Transient
private NavigableMap<String, Integer> unInstallHistory = new TreeMap<>();
private Map<String, TranslatedMetadata> translatedMetadataList = new TreeMap<>();
LocalizedLanguage defaultLanguage;
private Date updateDate = new Date();
private Date createDate = new Date();
}
提前感谢您的帮助。
英文:
In my elasticsearch, I have list of apk with category apps and games and a lot of metadata.
I have to return the list of top trading apk by category. My request must take into account and sort by best combination of:
- Most downloaded apk (apps or games) in the current week
- Most positively rated
- Most commented
How could I do this kind of request please ?
I use spring 2.2 and spring elastic search 3.2.4.
@Data
@NoArgsConstructor
@ToString
@Document(indexName = "apk")
public class Apk {
@Id //The unique id
private Long id;
@Field(type = FieldType.Nested, includeInParent = true)
private Rating rating = new Rating();
@Field(type = FieldType.Nested, includeInParent = true)
private List<Review> userReview = new ArrayList<>();
@Field(type = FieldType.Nested, includeInParent = true)
private Category category;
@Field(type = FieldType.Nested, includeInParent = true)
private SubCategory subCategory;
private ApkStatus status = ApkStatus.INITIATED;
private Set<String> dependencies = new HashSet<>();
private Set<String> permissions = new HashSet<>();
private String changes;
private Long companyId;
private String description;
private String displayName;
private String packageName = "unknown";
private BigDecimal price = new BigDecimal(0);
private String shortDescription;
private String versionName = "unknown";
private String videoUrl;
private Boolean containsAds;
private Boolean isFree=false;
private long versionCode = 0;
private String minSdkVersion;
private String targetSdkVersion;
private String maxSdkVersion;
private long installs;
private long unInstalls;
private long size;
private String apkName;
private String repositoryGeneratedId;
private String iconPath;
private String iconDownloadUrl;
private String apkPath;
private String apkDownloadUrl;
private String installHistoryString;
private String unInstallHistoryString;
@Transient
private NavigableMap<String, Integer> installHistory = new TreeMap<>();
@Transient
private NavigableMap<String, Integer> unInstallHistory = new TreeMap<>();
private Map<String, TranslatedMetadata> translatedMetadataList = new TreeMap<>();
LocalizedLanguage defaultLanguage;
private Date updateDate = new Date();
private Date createDate = new Date();
Thanks in advance
专注分享java语言的经验与见解,让所有开发者获益!
评论