本文整理匯總了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);
}