Пример #1
0
bool MangoExact::matchBinary (const Array<char> &target_buf, const Array<char> *xyz_buf)
{
   BufferScanner scanner(target_buf);

   if (xyz_buf == 0)
      return matchBinary(scanner, 0);

   BufferScanner xyz_scanner(*xyz_buf);
   return matchBinary(scanner, &xyz_scanner);
}
Пример #2
0
void MangoFastIndex::_match (OracleEnv &env, int idx)
{
   _last_id = idx;

   BingoStorage &storage = this->_context.context().context().storage;
   QS_DEF(Array<char>, stored);
   
   storage.get(idx, stored);

   if (stored[0] != 0)
      return; // molecule was removed from index

   BufferScanner scanner(stored);

   scanner.skip(1); // skip the deletion mark
   scanner.skip(scanner.readByte()); // skip the compessed rowid
   scanner.skip(2); // skip 'ord' bits count
   
   bool res = false;

   profTimerStart(tall, "match");
   if (_fetch_type == _SUBSTRUCTURE)
   {
      QS_DEF(Array<char>, xyz_buf);
      
      if (_context.substructure.needCoords())
      {
         OraRowidText rid;

         _decompressRowid(stored, rid);
         if (_loadCoords(env, rid.ptr(), xyz_buf))
         {
            BufferScanner xyz_scanner(xyz_buf);

            res = _context.substructure.matchBinary(scanner, &xyz_scanner);
         }
         else
            // no XYZ --> skip the molecule
            res = false;
      }
      else
         res = _context.substructure.matchBinary(scanner, 0);
   }
   else if (_fetch_type == _TAUTOMER_SUBSTRUCTURE)
      res = _context.tautomer.matchBinary(scanner);
   else // _fetch_type == _SIMILARITY
      res = _context.similarity.matchBinary(scanner);

   profTimerStop(tall);
   
   if (res)
   {
      OraRowidText & rid = matched.at(matched.add());

      _decompressRowid(stored, rid);

      profIncTimer("match.found", profTimerGetTime(tall));
      _matched++;
   }
   else
   {
      profIncTimer("match.not_found", profTimerGetTime(tall));
      _unmatched++;
   }
}