本文整理汇总了Java中org.apache.lucene.util.NumericUtils.prefixCodedToLong方法的典型用法代码示例。如果您正苦于以下问题:Java NumericUtils.prefixCodedToLong方法的具体用法?Java NumericUtils.prefixCodedToLong怎么用?Java NumericUtils.prefixCodedToLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.NumericUtils
的用法示例。
在下文中一共展示了NumericUtils.prefixCodedToLong方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toObject
import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public Object toObject(SchemaField sf, BytesRef term) {
switch (type) {
case INTEGER:
return NumericUtils.prefixCodedToInt(term);
case FLOAT:
return NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(term));
case LONG:
return NumericUtils.prefixCodedToLong(term);
case DOUBLE:
return NumericUtils.sortableLongToDouble(NumericUtils.prefixCodedToLong(term));
case DATE:
return new Date(NumericUtils.prefixCodedToLong(term));
default:
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + type);
}
}
示例2: next
import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
public Long next() throws IOException {
final BytesRef term = termsEnum.next();
if (term == null) {
return null;
}
if (termEncoding == GeoPointField.TermEncoding.PREFIX) {
return GeoEncodingUtils.prefixCodedToGeoCoded(term);
} else if (termEncoding == GeoPointField.TermEncoding.NUMERIC) {
return NumericUtils.prefixCodedToLong(term);
}
throw new IllegalArgumentException("GeoPoint.TermEncoding should be one of: " + GeoPointField.TermEncoding.PREFIX
+ " or " + GeoPointField.TermEncoding.NUMERIC + " found: " + termEncoding);
}
示例3: parseLong
import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public long parseLong(BytesRef term) {
return NumericUtils.prefixCodedToLong(term);
}
示例4: toLong
import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public long toLong(BytesRef indexForm) {
return NumericUtils.prefixCodedToLong(indexForm);
}
示例5: toNumber
import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public Number toNumber(BytesRef indexForm) {
return NumericUtils.prefixCodedToLong(indexForm);
}
示例6: getFileSystemObject
import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
/**
* Gets the file system objects from the database.
*
* @param document - document containing the information
* @return the file system object loaded from the database.
*/
private FileSystem getFileSystemObject(Document document)
{
FileSystem fileSystem = null;
String type = document.get(DefaultUserWorkspaceIndexService.TYPE);
log.debug("The type = " + type);
log.debug("Personal file type " + FileSystemType.PERSONAL_FILE.getType());
log.debug(" equals personal file " + type.equals(FileSystemType.PERSONAL_FILE.getType()));
if( type.equals(FileSystemType.PERSONAL_FILE.getType()) )
{
log.debug( "personal file id = " + document.get(DefaultUserWorkspaceIndexService.PERSONAL_FILE_ID));
Long personalFileId = NumericUtils.prefixCodedToLong(document.get(DefaultUserWorkspaceIndexService.PERSONAL_FILE_ID));
fileSystem = userFileSystemService.getPersonalFile(personalFileId, false);
}
if( type.equals(FileSystemType.PERSONAL_FOLDER.getType()))
{
log.debug( "personal folder id = " + document.get(DefaultUserWorkspaceIndexService.PERSONAL_FOLDER_ID));
Long personalFolderId = NumericUtils.prefixCodedToLong(document.get(DefaultUserWorkspaceIndexService.PERSONAL_FOLDER_ID));
fileSystem = userFileSystemService.getPersonalFolder(personalFolderId, false);
}
if( type.equals(FileSystemType.SHARED_INBOX_FILE.getType()))
{
log.debug( "inbox file id = " + document.get(DefaultUserWorkspaceIndexService.SHARED_INBOX_FILE_ID));
Long inboxFileId = NumericUtils.prefixCodedToLong(document.get(DefaultUserWorkspaceIndexService.SHARED_INBOX_FILE_ID));
fileSystem = userFileSystemService.getSharedInboxFile(inboxFileId, false);
}
if( type.equals(FileSystemType.PERSONAL_ITEM.getType()))
{
log.debug( "personal id = " + document.get(DefaultUserWorkspaceIndexService.PERSONAL_ITEM_ID));
Long personalItemId = NumericUtils.prefixCodedToLong(document.get(DefaultUserWorkspaceIndexService.PERSONAL_ITEM_ID));
fileSystem = userPublishingFileSystemService.getPersonalItem(personalItemId, false);
}
if( type.equals(FileSystemType.PERSONAL_COLLECTION.getType()))
{
log.debug( "personal collection id = " + document.get(DefaultUserWorkspaceIndexService.PERSONAL_COLLECTION_ID));
Long personalCollectionId = NumericUtils.prefixCodedToLong(document.get(DefaultUserWorkspaceIndexService.PERSONAL_COLLECTION_ID));
fileSystem = userPublishingFileSystemService.getPersonalCollection(personalCollectionId, false);
}
if( type.equals(FileSystemType.GROUP_WORKSPACE_FILE.getType()) )
{
log.debug( "group workspace file id = " + document.get(DefaultUserWorkspaceIndexService.GROUP_WORKSPACE_FILE_ID));
Long groupWorkspaceFileId = NumericUtils.prefixCodedToLong(document.get(DefaultUserWorkspaceIndexService.GROUP_WORKSPACE_FILE_ID));
fileSystem = groupWorkspaceFileSystemService.getFile(groupWorkspaceFileId, false);
}
if( type.equals(FileSystemType.GROUP_WORKSPACE_FOLDER.getType()))
{
log.debug( "group workspace folder id = " + document.get(DefaultUserWorkspaceIndexService.GROUP_WORKSPACE_FOLDER_ID));
Long groupWorkspaceFolderId = NumericUtils.prefixCodedToLong(document.get(DefaultUserWorkspaceIndexService.GROUP_WORKSPACE_FOLDER_ID));
fileSystem = groupWorkspaceFileSystemService.getFolder(groupWorkspaceFolderId, false);
}
return fileSystem;
}
示例7: stringToMoney
import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
/**
* 将s转换成long,再转换成BigDecimal,除以1000。
*
* @param s
* @return
*/
public static BigDecimal stringToMoney(String s) {
BigDecimal number = new BigDecimal(NumericUtils.prefixCodedToLong(s));
return number.divide(MULTIPLE);
}