Search in sources :

Example 6 with HashSet

use of jetbrains.exodus.core.dataStructures.hash.HashSet in project xodus by JetBrains.

the class ExodusLuceneTestsBase method removeStopWord.

protected void removeStopWord(final String stopWord) {
    final HashSet<Object> stopSet = new HashSet<>();
    for (Object word : ((StopwordAnalyzerBase) analyzer).getStopwordSet()) {
        if (!stopWord.equals(new String((char[]) word))) {
            stopSet.add(word);
        }
    }
    analyzer = new EnglishAnalyzer(LUCENE_VERSION, stopSet);
}
Also used : StopwordAnalyzerBase(org.apache.lucene.analysis.StopwordAnalyzerBase) EnglishAnalyzer(org.apache.lucene.analysis.en.EnglishAnalyzer) HashSet(jetbrains.exodus.core.dataStructures.hash.HashSet)

Example 7 with HashSet

use of jetbrains.exodus.core.dataStructures.hash.HashSet in project xodus by JetBrains.

the class TreeCursorNoDuplicatesTest method testRandomInserts.

@Test
public void testRandomInserts() {
    final ByteIterable value = value("value");
    final Set<String> keys = new HashSet<>();
    for (int i = 0; i < 10000; ++i) {
        keys.add(rndString());
    }
    tm = createMutableTree(false, 1);
    for (final String key : keys) {
        Assert.assertTrue(tm.add(key(key), value));
    }
    testCursorOrder(new TreeSet<>(keys));
}
Also used : ByteIterable(jetbrains.exodus.ByteIterable) ArrayByteIterable(jetbrains.exodus.ArrayByteIterable) HashSet(jetbrains.exodus.core.dataStructures.hash.HashSet) Test(org.junit.Test)

Aggregations

HashSet (jetbrains.exodus.core.dataStructures.hash.HashSet)7 Test (org.junit.Test)3 ArrayByteIterable (jetbrains.exodus.ArrayByteIterable)2 ByteIterable (jetbrains.exodus.ByteIterable)2 SecureRandom (java.security.SecureRandom)1 EntityIterableHandleBase (jetbrains.exodus.entitystore.iterate.EntityIterableHandleBase)1 EntityIteratorWithPropId (jetbrains.exodus.entitystore.iterate.EntityIteratorWithPropId)1 Environment (jetbrains.exodus.env.Environment)1 Transaction (jetbrains.exodus.env.Transaction)1 Index (jetbrains.exodus.query.metadata.Index)1 StopwordAnalyzerBase (org.apache.lucene.analysis.StopwordAnalyzerBase)1 EnglishAnalyzer (org.apache.lucene.analysis.en.EnglishAnalyzer)1