Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
Signed-off-by: mgodwan <mgodwan@amazon.com>
  • Loading branch information
mgodwan committed Oct 31, 2023
1 parent a10dd7f commit aac94d4
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import java.util.Iterator;
import java.util.List;

/**
* Encapsulates common behaviour implementation for a fuzzy set.
*/
public abstract class AbstractFuzzySet implements FuzzySet {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.automaton.CompiledAutomaton;
import org.opensearch.common.util.io.IOUtils;

import java.io.Closeable;
import java.io.IOException;
Expand All @@ -40,6 +40,9 @@
import java.util.List;
import java.util.Map;

/**
* Based on Lucene's BloomFilterPostingsFormat.
*/
public final class FuzzyFilterPostingsFormat extends PostingsFormat {

private static final Logger logger = LogManager.getLogger(FuzzyFilterPostingsFormat.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public interface FuzzySet extends Accountable, Closeable {

void writeTo(DataOutput out) throws IOException;

/**
* Enum to represent result of membership check on a fuzzy set.
*/
enum Result {
/**
* A definite no for the set membership of an item.
Expand All @@ -55,6 +58,9 @@ enum Result {
MAYBE
}

/**
* Enum to declare supported properties and mappings for a fuzzy set implementation.
*/
enum SetType {
BLOOM_FILTER_V1("bloom_filter_v1", BloomFilter::new, List.of("bloom_filter"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* Factory class to create fuzzy set.
* Supports bloom filters for now. More sets can be added as required.
*/
public class FuzzySetFactory {

private final Map<String, FuzzySetParameters> setTypeForField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

import java.util.function.Supplier;

/**
* Wrapper for params to create a fuzzy set.
*/
public class FuzzySetParameters {
private final Supplier<Double> falsePositiveProbabilityProvider;
private final FuzzySet.SetType setType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import java.nio.BufferOverflowException;
import java.util.concurrent.atomic.AtomicBoolean;

/**
* A Long array backed by RandomAccessInput.
*/
public class IndexInputLongArray implements LongArray {

public RandomAccessInput input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import java.io.Closeable;
import java.io.IOException;

/**
* A bitset backed by a long-indexed array.
*/
public class LongArrayBackedBitSet implements Accountable, Closeable {

private long underlyingArrayLength = 0L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import org.apache.lucene.util.BitUtil;
import org.apache.lucene.util.BytesRef;

/**
* Utility to calculate hash for incoming bytes.
*/
public class MurmurHash64 {
private static final long M64 = 0xc6a4a7935bd1e995L;
private static final int R64 = 47;
Expand Down

0 comments on commit aac94d4

Please sign in to comment.