示例#1
0
      @Override
      public Document createDocument(Artist artist, MusicFolder musicFolder) {
        Document doc = new Document();
        doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(artist.getId()));
        doc.add(new Field(FIELD_ARTIST, artist.getName(), Field.Store.YES, Field.Index.ANALYZED));
        doc.add(
            new NumericField(FIELD_FOLDER_ID, Field.Store.NO, true)
                .setIntValue(musicFolder.getId()));

        return doc;
      }
 private File getArtistImage(int id) {
   Artist artist = artistDao.getArtist(id);
   return artist == null || artist.getCoverArtPath() == null
       ? null
       : new File(artist.getCoverArtPath());
 }