mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-21 00:00:13 +02:00
417ed5102e
an iteration of key elements in kelondroTree databases is no longer supported. this is now replaced by an iteration of kelondroRow.Entry objects from the database Iteration of keys from the database was mostly followed by retrieval of the row from the database, whcih caused unnecessary database load. The index selection was also redesigned to use the new row iteration methods. This affects many funktions, most important is the DHT selection routine which is now much faster. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2327 6c8d7289-2bf4-0310-a012-ef5d649a1542
127 lines
3.8 KiB
Java
127 lines
3.8 KiB
Java
// indexCollectionRI.java
|
|
// (C) 2006 by Michael Peter Christen; mc@anomic.de, Frankfurt a. M., Germany
|
|
// first published 03.07.2006 on http://www.anomic.de
|
|
//
|
|
// This is a part of YaCy, a peer-to-peer based web search engine
|
|
//
|
|
// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
|
|
// $LastChangedRevision: 1986 $
|
|
// $LastChangedBy: orbiter $
|
|
//
|
|
// LICENSE
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program; if not, write to the Free Software
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
package de.anomic.index;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.util.Iterator;
|
|
|
|
import de.anomic.kelondro.kelondroCollectionIndex;
|
|
import de.anomic.kelondro.kelondroNaturalOrder;
|
|
import de.anomic.kelondro.kelondroRow;
|
|
|
|
public class indexCollectionRI extends indexAbstractRI implements indexRI {
|
|
|
|
kelondroCollectionIndex collectionIndex;
|
|
|
|
public indexCollectionRI(File path, String filenameStub, long buffersize, long preloadTime) throws IOException {
|
|
kelondroRow rowdef = new kelondroRow(new int[]{});
|
|
|
|
collectionIndex = new kelondroCollectionIndex(
|
|
path, filenameStub, 9 /*keyLength*/,
|
|
kelondroNaturalOrder.naturalOrder, buffersize, preloadTime,
|
|
4 /*loadfactor*/, rowdef, 8 /*partitions*/);
|
|
}
|
|
|
|
public int size() {
|
|
try {
|
|
return collectionIndex.size();
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public Iterator wordContainers(String startWordHash, boolean rot) {
|
|
return new wordContainersIterator(startWordHash, rot);
|
|
}
|
|
|
|
public class wordContainersIterator implements Iterator {
|
|
|
|
//private Iterator wci;
|
|
|
|
public wordContainersIterator(String startWordHash, boolean rot) {
|
|
|
|
}
|
|
|
|
public boolean hasNext() {
|
|
// TODO Auto-generated method stub
|
|
return false;
|
|
}
|
|
|
|
public Object next() {
|
|
// TODO Auto-generated method stub
|
|
return null;
|
|
}
|
|
|
|
public void remove() {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public indexContainer getContainer(String wordHash, boolean deleteIfEmpty, long maxtime) {
|
|
try {
|
|
indexRowSetContainer idx = (indexRowSetContainer) collectionIndex.get(wordHash.getBytes());
|
|
idx.setWordHash(wordHash);
|
|
return idx;
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public indexContainer deleteContainer(String wordHash) {
|
|
indexContainer idx = getContainer(wordHash, true, -1);
|
|
try {
|
|
collectionIndex.remove(wordHash.getBytes());
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
return idx;
|
|
}
|
|
|
|
public int removeEntries(String wordHash, String[] referenceHashes, boolean deleteComplete) {
|
|
// TODO Auto-generated method stub
|
|
return 0;
|
|
}
|
|
|
|
public indexContainer addEntries(indexContainer newEntries, long creationTime, boolean dhtCase) {
|
|
// TODO Auto-generated method stub
|
|
return null;
|
|
}
|
|
|
|
public void close(int waitingSeconds) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|