Esempio n. 1
0
 public Long[] getIndexValues(Object value) {
   if (hasIndexedAttributes) {
     int indexCount = mapIndexes.size();
     Long[] newIndexes = new Long[indexCount];
     if (value instanceof Data) {
       value = toObject((Data) value);
     }
     Collection<Index> indexes = mapIndexes.values();
     for (Index index : indexes) {
       int attributedIndex = index.getAttributeIndex();
       newIndexes[attributedIndex] = index.extractLongValue(value);
     }
     byte[] _indexTypes = indexTypes;
     if (_indexTypes == null || _indexTypes.length != indexCount) {
       synchronized (indexTypesLock) {
         _indexTypes = indexTypes;
         if (_indexTypes == null || _indexTypes.length != indexCount) {
           _indexTypes = new byte[indexCount];
           for (Index index : indexes) {
             int attributedIndex = index.getAttributeIndex();
             _indexTypes[attributedIndex] = index.getIndexType();
           }
           indexTypes = _indexTypes;
         }
       }
     }
     return newIndexes;
   }
   return null;
 }
Esempio n. 2
0
 void synchronize(DbSession session, DeprecatedDao dao, Index index) {
   long count = index.getIndexStat().getDocumentCount();
   Date lastSynch = index.getLastSynchronization();
   LOG.info("Index {}s", index.getIndexType());
   if (count <= 0) {
     dao.synchronizeAfter(session);
   } else {
     dao.synchronizeAfter(session, lastSynch);
   }
 }