- public void index(Document doc, Entity entity) throws StorageObjectFailure{
- EntityList video = DatabaseContentToMedia.getInstance().getVideo((EntityContent) entity);
- if (video != null && video.size()>0){
- doc.add(Field.Keyword(matchField,"y"));
+/**
+ * indexes whether an Enity has video
+ */
+public class VideoSearchTerm extends SearchTerm {
+ public VideoSearchTerm() {
+ super(null, "search_hasVideo", "hasVideo", null, "hasVideo");
+ }
+
+ public void index(Document doc, Entity entity) throws DatabaseFailure {
+ List extraTables = new ArrayList();
+ extraTables.add("content_x_media cxm");
+
+ Iterator videos = new EntityBrowser(
+ DatabaseVideo.getInstance(), "i", extraTables,
+ "cxm.content_id="+entity.getId()+"and cxm.media_id=i.id",
+ "i.id desc", 30, -1, 0);
+
+ if ((videos != null) && (videos.hasNext())) {
+ doc.add(Field.Keyword(matchField, "y"));