Java 类org.apache.lucene.document.NumericField 实例源码

项目:airsonic    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));
    doc.add(new Field(FIELD_MEDIA_TYPE, mediaFile.getMediaType().name(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));

    if (mediaFile.getTitle() != null) {
        doc.add(new Field(FIELD_TITLE, mediaFile.getTitle(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getGenre() != null) {
        doc.add(new Field(FIELD_GENRE, normalizeGenre(mediaFile.getGenre()), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getYear() != null) {
        doc.add(new NumericField(FIELD_YEAR, Field.Store.NO, true).setIntValue(mediaFile.getYear()));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:airsonic    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:airsonic    文件:SearchService.java   
@Override
public Document createDocument(Album album) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(album.getId()));

    if (album.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, album.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (album.getName() != null) {
        doc.add(new Field(FIELD_ALBUM, album.getName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (album.getFolderId() != null) {
        doc.add(new NumericField(FIELD_FOLDER_ID, Field.Store.NO, true).setIntValue(album.getFolderId()));
    }

    return doc;
}
项目:sjk    文件:QuickTipsServiceImpl.java   
private void addAppsToIndexerWriter(List<App> list, IndexWriter indexerWriter) {
    Field name = new Field(fieldName, "", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
    NumericField catalog = new NumericField("catalog", Field.Store.NO, true);
    NumericField downloadRank = new NumericField("downloadRank", Field.Store.NO, true);
    for (App a : list) {
        try {
            Document doc = new Document();
            name.setValue(a.getName().toLowerCase());
            doc.add(name);
            downloadRank.setIntValue(a.getDownloadRank());
            doc.add(downloadRank);
            catalog.setIntValue(a.getCatalog());
            doc.add(catalog);
            indexerWriter.addDocument(doc);
        } catch (Exception e) {
            logger.error("Exception", e);
        }
    }
}
项目:subsonic    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));
    doc.add(new Field(FIELD_MEDIA_TYPE, mediaFile.getMediaType().name(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));

    if (mediaFile.getTitle() != null) {
        doc.add(new Field(FIELD_TITLE, mediaFile.getTitle(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getGenre() != null) {
        doc.add(new Field(FIELD_GENRE, normalizeGenre(mediaFile.getGenre()), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getYear() != null) {
        doc.add(new NumericField(FIELD_YEAR, Field.Store.NO, true).setIntValue(mediaFile.getYear()));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:subsonic    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:subsonic    文件:SearchService.java   
@Override
public Document createDocument(Album album) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(album.getId()));

    if (album.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, album.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (album.getName() != null) {
        doc.add(new Field(FIELD_ALBUM, album.getName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (album.getFolderId() != null) {
        doc.add(new NumericField(FIELD_FOLDER_ID, Field.Store.NO, true).setIntValue(album.getFolderId()));
    }

    return doc;
}
项目:exhibitor    文件:LogSearch.java   
public SearchItem toResult(int documentId) throws IOException
{
    Document        document = searcher.doc(documentId);

    String          type = document.getFieldable(FieldNames.TYPE).stringValue();
    NumericField    date = (NumericField)document.getFieldable(FieldNames.DATE);
    Fieldable       path = document.getFieldable(FieldNames.PATH);
    NumericField    version = (NumericField)document.getFieldable(FieldNames.VERSION);
    return new SearchItem
    (
        Integer.parseInt(type),
        path.stringValue(),
        (version != null) ? version.getNumericValue().intValue() : -1,
        new Date(date.getNumericValue().longValue())
    );
}
项目:exhibitor    文件:IndexBuilder.java   
private Document makeDocument(TxnHeader header, EntryTypes type, AtomicInteger count, AtomicLong from, AtomicLong to)
{
    count.incrementAndGet();
    if ( header.getTime() < from.get() )
    {
        from.set(header.getTime());
    }
    if ( header.getTime() > to.get() )
    {
        to.set(header.getTime());
    }

    NumericField dateField = new NumericField(FieldNames.DATE, Field.Store.YES, true);
    dateField.setLongValue(header.getTime());

    Document    document = new Document();
    document.add(new Field(FieldNames.TYPE, Integer.toString(type.getId()), Field.Store.YES, Field.Index.NOT_ANALYZED));
    document.add(dateField);
    return document;
}
项目:FutureSonic-Server    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
    }
    return doc;
}
项目:madsonic-server-5.1    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
    }
    return doc;
}
项目:GeoprocessingAppstore    文件:DoubleField.java   
/**
 * Makes the fieldable to index.
 * @param value the value
 * @return the fieldable
 */
@Override
protected Fieldable makeFieldable(Object value) {
  Double dValue = null;
  if (value instanceof Double) {
    dValue = (Double)value;
  } else if (value instanceof String) {
    try {
      PropertyValueType valueType = PropertyValueType.DOUBLE;
      dValue = (Double)valueType.evaluate((String)value);
    } catch (IllegalArgumentException e) {}      
  }
  if (dValue != null) {
    boolean bIndex = !this.getIndexingOption().equals(Field.Index.NO);
    NumericField fld = new NumericField(this.getName(),this.getStorageOption(),bIndex);
    fld.setDoubleValue(dValue);
    return fld;
  } else {
    return null;
  }
}
项目:GeoprocessingAppstore    文件:TimestampField.java   
/**
 * Makes the fieldable to index.
 * @param value the value
 * @return the fieldable
 */
protected Fieldable makeFieldable(Object value) {
  Timestamp tsValue = null;
  if (value instanceof Timestamp) {
    tsValue = (Timestamp)value;
  } else if (value instanceof String) {
    try {
      PropertyValueType valueType = PropertyValueType.TIMESTAMP;
      tsValue = (Timestamp)valueType.evaluate((String)value);
    } catch (IllegalArgumentException e) {}      
  }
  if (tsValue != null) {
    boolean bIndex = !this.getIndexingOption().equals(Field.Index.NO);
    NumericField fld = new NumericField(this.getName(),this.getStorageOption(),bIndex);
    fld.setLongValue(tsValue.getTime());
    return fld;
  } else {
    return null;
  }
}
项目:GeoprocessingAppstore    文件:LongField.java   
/**
 * Makes the fieldable to index.
 * @param value the value
 * @return the fieldable
 */
@Override
protected Fieldable makeFieldable(Object value) {
  Long lValue = null;
  if (value instanceof Long) {
    lValue = (Long)value;
  } else if (value instanceof String) {
    try {
      PropertyValueType valueType = PropertyValueType.LONG;
      lValue = (Long)valueType.evaluate((String)value);
    } catch (IllegalArgumentException e) {}      
  }
  if (lValue != null) {
    boolean bIndex = !this.getIndexingOption().equals(Field.Index.NO);
    NumericField fld = new NumericField(this.getName(),this.getStorageOption(),bIndex);
    fld.setLongValue(lValue);
    return fld;
  } else {
    return null;
  }
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
    }
    return doc;
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
    }
    return doc;
}
项目:usgin-geoportal    文件:DoubleField.java   
/**
 * Makes the fieldable to index.
 * @param value the value
 * @return the fieldable
 */
@Override
protected Fieldable makeFieldable(Object value) {
  Double dValue = null;
  if (value instanceof Double) {
    dValue = (Double)value;
  } else if (value instanceof String) {
    try {
      PropertyValueType valueType = PropertyValueType.DOUBLE;
      dValue = (Double)valueType.evaluate((String)value);
    } catch (IllegalArgumentException e) {}      
  }
  if (dValue != null) {
    boolean bIndex = !this.getIndexingOption().equals(Field.Index.NO);
    NumericField fld = new NumericField(this.getName(),this.getStorageOption(),bIndex);
    fld.setDoubleValue(dValue);
    return fld;
  } else {
    return null;
  }
}
项目:usgin-geoportal    文件:TimestampField.java   
/**
 * Makes the fieldable to index.
 * @param value the value
 * @return the fieldable
 */
protected Fieldable makeFieldable(Object value) {
  Timestamp tsValue = null;
  if (value instanceof Timestamp) {
    tsValue = (Timestamp)value;
  } else if (value instanceof String) {
    try {
      PropertyValueType valueType = PropertyValueType.TIMESTAMP;
      tsValue = (Timestamp)valueType.evaluate((String)value);
    } catch (IllegalArgumentException e) {}      
  }
  if (tsValue != null) {
    boolean bIndex = !this.getIndexingOption().equals(Field.Index.NO);
    NumericField fld = new NumericField(this.getName(),this.getStorageOption(),bIndex);
    fld.setLongValue(tsValue.getTime());
    return fld;
  } else {
    return null;
  }
}
项目:usgin-geoportal    文件:LongField.java   
/**
 * Makes the fieldable to index.
 * @param value the value
 * @return the fieldable
 */
@Override
protected Fieldable makeFieldable(Object value) {
  Long lValue = null;
  if (value instanceof Long) {
    lValue = (Long)value;
  } else if (value instanceof String) {
    try {
      PropertyValueType valueType = PropertyValueType.LONG;
      lValue = (Long)valueType.evaluate((String)value);
    } catch (IllegalArgumentException e) {}      
  }
  if (lValue != null) {
    boolean bIndex = !this.getIndexingOption().equals(Field.Index.NO);
    NumericField fld = new NumericField(this.getName(),this.getStorageOption(),bIndex);
    fld.setLongValue(lValue);
    return fld;
  } else {
    return null;
  }
}
项目:airsonic    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:airsonic    文件:SearchService.java   
@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;
}
项目:subsonic    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:subsonic    文件:SearchService.java   
@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;
}
项目:webdsl    文件:AutoCompleter.java   
private static Document createDocument(String text, int freq) {
  Document doc = new Document();
  // the word field is never queried on... its indexed so it can be quickly
  // checked for rebuild (and stored for retrieval). Doesn't need norms or TF/pos
  Field f = new Field(F_WORD, text, Field.Store.YES, Field.Index.NOT_ANALYZED);
  f.setOmitTermFreqAndPositions(true);
  f.setOmitNorms(true);
  doc.add(f); // orig term
  NumericField nf = new NumericField(F_FREQ).setIntValue(freq);
  doc.add(nf);
  addGram(text, doc);
  return doc;
}
项目:FutureSonic-Server    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));
    doc.add(new Field(FIELD_MEDIA_TYPE, mediaFile.getMediaType().name(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));

    if (mediaFile.getTitle() != null) {
        doc.add(new Field(FIELD_TITLE, mediaFile.getTitle(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getGenre() != null) {
        doc.add(new Field(FIELD_GENRE, normalizeGenre(mediaFile.getGenre()), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getMood() != null) {
        doc.add(new Field(FIELD_MOOD, mediaFile.getMood(), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getYear() != null) {
        doc.add(new NumericField(FIELD_YEAR, Field.Store.NO, true).setIntValue(mediaFile.getYear()));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:FutureSonic-Server    文件:SearchService.java   
@Override
public Document createDocument(Album album) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(album.getId()));

    if (album.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, album.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (album.getName() != null) {
        doc.add(new Field(FIELD_ALBUM, album.getName(), Field.Store.YES, Field.Index.ANALYZED));
    }

    return doc;
}
项目:FutureSonic-Server    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }

    return doc;
}
项目:FutureSonic-Server    文件:SearchService.java   
@Override
public Document createDocument(Artist artist) {
    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));

    return doc;
}
项目:madsonic-server-5.1    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));
    doc.add(new Field(FIELD_MEDIA_TYPE, mediaFile.getMediaType().name(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));

    if (mediaFile.getTitle() != null) {
        doc.add(new Field(FIELD_TITLE, mediaFile.getTitle(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getGenre() != null) {
        doc.add(new Field(FIELD_GENRE, normalize(mediaFile.getGenre()), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getMood() != null) {
        doc.add(new Field(FIELD_MOOD, mediaFile.getMood(), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getYear() != null) {
        doc.add(new NumericField(FIELD_YEAR, Field.Store.NO, true).setIntValue(mediaFile.getYear()));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:madsonic-server-5.1    文件:SearchService.java   
@Override
public Document createDocument(Album album) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(album.getId()));

    if (album.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, album.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (album.getName() != null) {
        doc.add(new Field(FIELD_ALBUM, album.getName(), Field.Store.YES, Field.Index.ANALYZED));
    }

    return doc;
}
项目:madsonic-server-5.1    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }

    return doc;
}
项目:madsonic-server-5.1    文件:SearchService.java   
@Override
public Document createDocument(Artist artist) {
    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));

    return doc;
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));
    doc.add(new Field(FIELD_MEDIA_TYPE, mediaFile.getMediaType().name(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));

    if (mediaFile.getTitle() != null) {
        doc.add(new Field(FIELD_TITLE, mediaFile.getTitle(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getGenre() != null) {
        doc.add(new Field(FIELD_GENRE, normalize(mediaFile.getGenre()), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getMood() != null) {
        doc.add(new Field(FIELD_MOOD, mediaFile.getMood(), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getYear() != null) {
        doc.add(new NumericField(FIELD_YEAR, Field.Store.NO, true).setIntValue(mediaFile.getYear()));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(Album album) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(album.getId()));

    if (album.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, album.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (album.getName() != null) {
        doc.add(new Field(FIELD_ALBUM, album.getName(), Field.Store.YES, Field.Index.ANALYZED));
    }

    return doc;
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }

    return doc;
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(Artist artist) {
    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));

    return doc;
}
项目:neo4j-mobile-android    文件:IndexType.java   
Fieldable instantiateField( String key, Object value, Index analyzed )
{
    Fieldable field = null;
    if ( value instanceof Number )
    {
        Number number = (Number) value;
        NumericField numberField = new NumericField( key, Store.YES, true );
        if ( value instanceof Long )
        {
            numberField.setLongValue( number.longValue() );
        }
        else if ( value instanceof Float )
        {
            numberField.setFloatValue( number.floatValue() );
        }
        else if ( value instanceof Double )
        {
            numberField.setDoubleValue( number.doubleValue() );
        }
        else
        {
            numberField.setIntValue( number.intValue() );
        }
        field = numberField;
    }
    else
    {
        field = new Field( key, value.toString(), Store.YES, analyzed );
    }
    return field;
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));
    doc.add(new Field(FIELD_MEDIA_TYPE, mediaFile.getMediaType().name(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));

    if (mediaFile.getTitle() != null) {
        doc.add(new Field(FIELD_TITLE, mediaFile.getTitle(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getAlbumName() != null) {
        doc.add(new Field(FIELD_ALBUM, mediaFile.getAlbumName(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (mediaFile.getGenre() != null) {
        doc.add(new Field(FIELD_GENRE, normalize(mediaFile.getGenre()), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getMood() != null) {
        doc.add(new Field(FIELD_MOOD, mediaFile.getMood(), Field.Store.NO, Field.Index.ANALYZED));
    }
    if (mediaFile.getYear() != null) {
        doc.add(new NumericField(FIELD_YEAR, Field.Store.NO, true).setIntValue(mediaFile.getYear()));
    }
    if (mediaFile.getFolder() != null) {
        doc.add(new Field(FIELD_FOLDER, mediaFile.getFolder(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
    }

    return doc;
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(Album album) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(album.getId()));

    if (album.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, album.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }
    if (album.getName() != null) {
        doc.add(new Field(FIELD_ALBUM, album.getName(), Field.Store.YES, Field.Index.ANALYZED));
    }

    return doc;
}
项目:madsonic-server-5.0    文件:SearchService.java   
@Override
public Document createDocument(MediaFile mediaFile) {
    Document doc = new Document();
    doc.add(new NumericField(FIELD_ID, Field.Store.YES, false).setIntValue(mediaFile.getId()));

    if (mediaFile.getArtist() != null) {
        doc.add(new Field(FIELD_ARTIST, mediaFile.getArtist(), Field.Store.YES, Field.Index.ANALYZED));
    }

    return doc;
}