buggy_function stringlengths 1 391k | fixed_function stringlengths 0 392k |
|---|---|
public static final String MSG = " Processing Documemt # ";
} | public static final String MSG = " Processing Document # ";
} |
public static String timeToString(long time) {
if (time < 0)
throw new RuntimeException("time too early");
String s = Long.toString(time, Character.MAX_RADIX);
if (s.length() > DATE_LEN)
throw new RuntimeException("time too late");
// Pad with leading zeros
if (s.length() < DATE_LEN... | public static String timeToString(long time) {
if (time < 0)
throw new RuntimeException("time too early");
String s = Long.toString(time, Character.MAX_RADIX);
if (s.length() > DATE_LEN)
throw new RuntimeException("time too late");
// Pad with leading zeros
if (s.length() < DATE_LEN... |
public void testCompactionPurgeTombstonedRow() throws IOException, ExecutionException, InterruptedException
{
CompactionManager.instance.disableAutoCompaction();
String tableName = "RowCacheSpace";
String cfName = "CachedCF";
Table table = Table.open(tableName);
ColumnFa... | public void testCompactionPurgeTombstonedRow() throws IOException, ExecutionException, InterruptedException
{
CompactionManager.instance.disableAutoCompaction();
String tableName = "RowCacheSpace";
String cfName = "CachedCF";
Table table = Table.open(tableName);
ColumnFa... |
private static void writeStatistics(Descriptor desc, EstimatedHistogram rowSizes, EstimatedHistogram columnnCounts) throws IOException
{
DataOutputStream out = new DataOutputStream(new FileOutputStream(desc.filenameFor(SSTable.COMPONENT_STATS)));
EstimatedHistogram.serializer.serialize(rowSizes,... | private static void writeStatistics(Descriptor desc, EstimatedHistogram rowSizes, EstimatedHistogram columnnCounts) throws IOException
{
DataOutputStream out = new DataOutputStream(new FileOutputStream(desc.filenameFor(SSTable.COMPONENT_STATS)));
EstimatedHistogram.serializer.serialize(rowSizes,... |
public void connect() {
if (zkStateReader == null) {
synchronized (this) {
if (zkStateReader == null) {
try {
ZkStateReader zk = new ZkStateReader(zkHost, zkConnectTimeout,
zkClientTimeout, true);
zk.createClusterStateWatchersAndUpdate();
... | public void connect() {
if (zkStateReader == null) {
synchronized (this) {
if (zkStateReader == null) {
try {
ZkStateReader zk = new ZkStateReader(zkHost, zkConnectTimeout,
zkClientTimeout);
zk.createClusterStateWatchersAndUpdate();
zkSta... |
public int advance(int target) throws IOException {
// first scan in cache
for (pointer++; pointer < pointerMax; pointer++) {
if (docs[pointer] >= target) {
freq = freqs[pointer];
return doc = docs[pointer];
}
}
// not found in readahead cache, seek underlying stream
i... | public int advance(int target) throws IOException {
// first scan in cache
for (pointer++; pointer < pointerMax; pointer++) {
if (docs[pointer] >= target) {
freq = freqs[pointer];
return doc = docs[pointer];
}
}
// not found in readahead cache, seek underlying stream
i... |
private void rehash(final int newSize, boolean hashOnData) {
final int newMask = newSize - 1;
bytesUsed.addAndGet(RamUsageEstimator.NUM_BYTES_INT * (newSize));
final int[] newHash = new int[newSize];
Arrays.fill(newHash, -1);
for (int i = 0; i < hashSize; i++) {
final int e0 = ords[i];
... | private void rehash(final int newSize, boolean hashOnData) {
final int newMask = newSize - 1;
bytesUsed.addAndGet(RamUsageEstimator.NUM_BYTES_INT * (newSize));
final int[] newHash = new int[newSize];
Arrays.fill(newHash, -1);
for (int i = 0; i < hashSize; i++) {
final int e0 = ords[i];
... |
public void bindResultColumnsByName(ResultColumnList fullRCL,
FromVTI targetVTI,
DMLStatementNode statement)
throws StandardException
{
int size = size();
Hashtable ht = new Hashtable(size + 2, (float) .999);
for (int index = 0; index < size; index++)
{
ResultColumn matchRC;
... | public void bindResultColumnsByName(ResultColumnList fullRCL,
FromVTI targetVTI,
DMLStatementNode statement)
throws StandardException
{
int size = size();
Hashtable ht = new Hashtable(size + 2, (float) .999);
for (int index = 0; index < size; index++)
{
ResultColumn matchRC;
... |
public void init(NamedList args) {
super.init(args);
List cmdlist = new ArrayList();
cmdlist.add(args.get("exe"));
List lst = (List)args.get("args");
if (lst != null) cmdlist.addAll(lst);
cmd = (String[])cmdlist.toArray(new String[cmdlist.size()]);
lst = (List)args.get("env");
if (ls... | public void init(NamedList args) {
super.init(args);
List cmdlist = new ArrayList();
cmdlist.add(args.get("exe"));
List lst = (List)args.get("args");
if (lst != null) cmdlist.addAll(lst);
cmd = (String[])cmdlist.toArray(new String[cmdlist.size()]);
lst = (List)args.get("env");
if (ls... |
public static void assertIndexEquals(DirectoryReader index1, DirectoryReader index2) throws IOException {
assertEquals("IndexReaders have different values for numDocs.", index1.numDocs(), index2.numDocs());
assertEquals("IndexReaders have different values for maxDoc.", index1.maxDoc(), index2.maxDoc());
a... | public static void assertIndexEquals(DirectoryReader index1, DirectoryReader index2) throws IOException {
assertEquals("IndexReaders have different values for numDocs.", index1.numDocs(), index2.numDocs());
assertEquals("IndexReaders have different values for maxDoc.", index1.maxDoc(), index2.maxDoc());
a... |
private final List<DocumentsWriterPerThread> fullFlushBuffer = new ArrayList<DocumentsWriterPerThread>();
void addFlushableState(ThreadState perThread) {
if (documentsWriter.infoStream.isEnabled("DWFC")) {
documentsWriter.infoStream.message("DWFC", Thread.currentThread().getName() + ": addFlushableState ... | private final List<DocumentsWriterPerThread> fullFlushBuffer = new ArrayList<DocumentsWriterPerThread>();
void addFlushableState(ThreadState perThread) {
if (documentsWriter.infoStream.isEnabled("DWFC")) {
documentsWriter.infoStream.message("DWFC", "addFlushableState " + perThread.dwpt);
}
final ... |
public String toString() {
if (VERBOSE_DELETES) {
return "gen=" + gen + " numTerms=" + numTermDeletes + ", terms=" + terms
+ ", queries=" + queries + ", docIDs=" + docIDs + ", bytesUsed="
+ bytesUsed;
} else {
String s = "gen=" + gen;
if (numTermDeletes.get() != 0) {
... | public String toString() {
if (VERBOSE_DELETES) {
return "gen=" + gen + " numTerms=" + numTermDeletes + ", terms=" + terms
+ ", queries=" + queries + ", docIDs=" + docIDs + ", bytesUsed="
+ bytesUsed;
} else {
String s = "gen=" + gen;
if (numTermDeletes.get() != 0) {
... |
public synchronized void printException(String where, Exception e) {
System.out.println(e.toString());
if (e instanceof SQLException) {
SQLException se = (SQLException) e;
if (se.getSQLState().equals("40001"))
System.out.println(getThreadName()
+ " dbUtil --> deadlocked detected");
if (se.ge... | public synchronized void printException(String where, Exception e) {
System.out.println(e.toString());
if (e instanceof SQLException) {
SQLException se = (SQLException) e;
if (se.getSQLState().equals("40001"))
System.out.println(getThreadName()
+ " dbUtil --> deadlocked detected");
if (se.ge... |
public static synchronized void printException(String where, Exception e) {
if (e instanceof SQLException) {
SQLException se = (SQLException) e;
if (se.getSQLState().equals("40001"))
System.out.println("deadlocked detected");
if (se.getSQLState().equals("40XL1"))
System.out.println(" lock timeout e... | public static synchronized void printException(String where, Exception e) {
if (e instanceof SQLException) {
SQLException se = (SQLException) e;
if (se.getSQLState().equals("40001"))
System.out.println("deadlocked detected");
if (se.getSQLState().equals("40XL1"))
System.out.println(" lock timeout e... |
public synchronized void printException(String where, Exception e) {
if (e instanceof SQLException) {
SQLException se = (SQLException) e;
if (se.getSQLState().equals("40001"))
System.out.println("deadlocked detected");
if (se.getSQLState().equals("40XL1"))
System.out.println(" lock timeout exceptio... | public synchronized void printException(String where, Exception e) {
if (e instanceof SQLException) {
SQLException se = (SQLException) e;
if (se.getSQLState().equals("40001"))
System.out.println("deadlocked detected");
if (se.getSQLState().equals("40XL1"))
System.out.println(" lock timeout exceptio... |
protected int getLevelForDistance(double degrees) {
QuadPrefixTree grid = new QuadPrefixTree(ctx, MAX_LEVELS_POSSIBLE);
return grid.getLevelForDistance(degrees) + 1;//returns 1 greater
}
| protected int getLevelForDistance(double degrees) {
QuadPrefixTree grid = new QuadPrefixTree(ctx, MAX_LEVELS_POSSIBLE);
return grid.getLevelForDistance(degrees);
}
|
protected int getLevelForDistance(double degrees) {
GeohashPrefixTree grid = new GeohashPrefixTree(ctx, GeohashPrefixTree.getMaxLevelsPossible());
return grid.getLevelForDistance(degrees) + 1;//returns 1 greater
}
| protected int getLevelForDistance(double degrees) {
GeohashPrefixTree grid = new GeohashPrefixTree(ctx, GeohashPrefixTree.getMaxLevelsPossible());
return grid.getLevelForDistance(degrees);
}
|
public UAX29URLEmailTokenizer create(Reader input) {
UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer(input);
tokenizer.setMaxTokenLength(maxTokenLength);
return tokenizer;
}
| public UAX29URLEmailTokenizer create(Reader input) {
UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer(luceneMatchVersion, input);
tokenizer.setMaxTokenLength(maxTokenLength);
return tokenizer;
}
|
public synchronized InputStream getRawByteStream()
throws IOException {
checkIfValid();
return this.bytes.getInputStream(0L);
}
/**
* Constructs a <code>TemporaryClob</code> object and
* initializes with a initial String.
* @param data initial value in String
... | public synchronized InputStream getRawByteStream()
throws IOException {
checkIfValid();
return this.bytes.getInputStream(0L);
}
/**
* Constructs a <code>TemporaryClob</code> object and
* initializes with a initial String.
* @param data initial value in String
... |
public ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList,
Vector aggregateVector)
throws StandardException
{
super.bindExpression(fromList, subqueryList,
aggregateVector);
/* Set type info for this node */
bindComparisonOperator();
return this;
}
| public ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList,
Vector aggregateVector)
throws StandardException
{
bindOperand(fromList, subqueryList,
aggregateVector);
/* Set type info for this node */
bindComparisonOperator();
return this;
}
|
public ValueNode bindExpression(
FromList fromList,
SubqueryList subqueryList,
Vector aggregateVector)
throws StandardException
{
int operandType;
TypeId opTypeId;
super.bindExpression(fromList, subqueryList,
aggregateVector);
opTypeId = operand.getTypeId();
operandType = opTypeId.getJDBCT... | public ValueNode bindExpression(
FromList fromList,
SubqueryList subqueryList,
Vector aggregateVector)
throws StandardException
{
int operandType;
TypeId opTypeId;
bindOperand(fromList, subqueryList,
aggregateVector);
opTypeId = operand.getTypeId();
operandType = opTypeId.getJDBCTypeId();
... |
public ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList,
Vector aggregateVector)
throws StandardException
{
TypeId operandType;
super.bindExpression(fromList, subqueryList,
aggregateVector);
/*
** Check the type of the operand - this function is allowed only on
** string v... | public ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList,
Vector aggregateVector)
throws StandardException
{
TypeId operandType;
bindOperand(fromList, subqueryList,
aggregateVector);
/*
** Check the type of the operand - this function is allowed only on
** string value type... |
private static void streamTest10(Connection conn) {
ResultSetMetaData met;
ResultSet rs;
Statement stmt;
System.out.println("Testing 10 starts from here");
try {
stmt = conn.createStatement();
//create the table
stmt.executeUpdate("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storag... | private static void streamTest10(Connection conn) {
ResultSetMetaData met;
ResultSet rs;
Statement stmt;
System.out.println("Testing 10 starts from here");
try {
stmt = conn.createStatement();
//create the table
stmt.executeUpdate("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storag... |
public String getBaseUrlForNodeName(final String nodeName) {
final int _offset = nodeName.indexOf("_");
if (_offset < 0) {
throw new IllegalArgumentException("nodeName does not contain expected '_' seperator: " + nodeName);
}
final String hostAndPort = nodeName.substring(0,_offset);
try {
... | public String getBaseUrlForNodeName(final String nodeName) {
final int _offset = nodeName.indexOf("_");
if (_offset < 0) {
throw new IllegalArgumentException("nodeName does not contain expected '_' seperator: " + nodeName);
}
final String hostAndPort = nodeName.substring(0,_offset);
try {
... |
public void testBigDocuments() throws IOException {
// much bigger than the chunk size
if (dir instanceof MockDirectoryWrapper) {
((MockDirectoryWrapper) dir).setThrottling(Throttling.NEVER);
}
final Document emptyDoc = new Document(); // emptyDoc
final Document bigDoc1 = new Document(); //... | public void testBigDocuments() throws IOException {
// much bigger than the chunk size
if (dir instanceof MockDirectoryWrapper) {
((MockDirectoryWrapper) dir).setThrottling(Throttling.NEVER);
}
final Document emptyDoc = new Document(); // emptyDoc
final Document bigDoc1 = new Document(); //... |
public int getSQLStateType()
{
return JDBC30Translation.SQL_STATE_SQL99;
}
| public int getSQLStateType()
{
return sqlStateSQL99;
}
|
private void ensureCapacity(int i) {
if((pos + i) >= bytes.length) {
byte[] tmp = bytes;
int newLength = bytes.length + bufferGrowthSize;
while(newLength < pos + i) {
newLength += bufferGrowthSize;
}
bytes = new byte[newLength];
System.arraycopy(tmp, 0... | private void ensureCapacity(int i) {
if((pos + i) >= bytes.length) {
byte[] tmp = bytes;
int newLength = bytes.length + bufferGrowthSize;
while(newLength < pos + i) {
newLength += bufferGrowthSize;
}
bytes = new byte[newLength];
System.arraycopy(tmp, 0... |
public Row resolve() throws DigestMismatchException, IOException
{
if (logger.isDebugEnabled())
logger.debug("resolving " + replies.size() + " responses");
long startTime = System.currentTimeMillis();
ColumnFamily resolved;
if (replies.size() > 1)
{
... | public Row resolve() throws DigestMismatchException, IOException
{
if (logger.isDebugEnabled())
logger.debug("resolving " + replies.size() + " responses");
long startTime = System.currentTimeMillis();
ColumnFamily resolved;
if (replies.size() > 1)
{
... |
public String toString() {
// super.toString returns the doc and score information, so just add the
// fields information
StringBuilder sb = new StringBuilder(super.toString());
sb.append("[");
for (int i = 0; i < fields.length; i++) {
sb.append(fields[i]).append(", ");
... | public String toString() {
// super.toString returns the doc and score information, so just add the
// fields information
StringBuilder sb = new StringBuilder(super.toString());
sb.append("[");
for (int i = 0; i < fields.length; i++) {
sb.append(fields[i]).append(", ");
... |
private void discardCompletedSegmentsInternal(CommitLogSegment.CommitLogContext context, Integer id) throws IOException
{
if (logger.isDebugEnabled())
logger.debug("discard completed log segments for " + context + ", column family " + id + ".");
/*
* Loop through all the co... | private void discardCompletedSegmentsInternal(CommitLogSegment.CommitLogContext context, Integer id) throws IOException
{
if (logger.isDebugEnabled())
logger.debug("discard completed log segments for " + context + ", column family " + id + ".");
/*
* Loop through all the co... |
public Similarity getSimilarity(Searcher s) {
return sim;
}
};
Scorer spanScorer = snq.weight(searcher).scorer(searcher.getIndexReader(), true, false);
assertTrue("first doc", spanScorer.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
assertEquals("first doc number", spanScorer.docI... | public Similarity getSimilarity(Searcher s) {
return sim;
}
};
Scorer spanScorer = searcher.createNormalizedWeight(snq).scorer(searcher.getIndexReader(), true, false);
assertTrue("first doc", spanScorer.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
assertEquals("first doc number",... |
public void testSort() throws Exception {
IndexReader reader = null;
Directory dir = null;
final int numDocs = atLeast(1000);
//final int numDocs = atLeast(50);
final String[] tokens = new String[] {"a", "b", "c", "d", "e"};
if (VERBOSE) {
System.out.println("TEST: make index");
... | public void testSort() throws Exception {
IndexReader reader = null;
Directory dir = null;
final int numDocs = atLeast(1000);
//final int numDocs = atLeast(50);
final String[] tokens = new String[] {"a", "b", "c", "d", "e"};
if (VERBOSE) {
System.out.println("TEST: make index");
... |
public int doLogic() throws Exception {
int res = 0;
// open reader or use existing one
IndexSearcher searcher = getRunData().getIndexSearcher();
IndexReader reader;
final boolean closeSearcher;
if (searcher == null) {
// open our own reader
Directory dir = getRunData().getDirec... | public int doLogic() throws Exception {
int res = 0;
// open reader or use existing one
IndexSearcher searcher = getRunData().getIndexSearcher();
IndexReader reader;
final boolean closeSearcher;
if (searcher == null) {
// open our own reader
Directory dir = getRunData().getDirec... |
private TopGroups<String> searchShards(IndexSearcher topSearcher, ShardState shardState, Query query, Sort groupSort, Sort docSort, int groupOffset, int topNGroups, int docOffset,
int topNDocs, boolean getScores, boolean getMaxScores) throws Exception {
// TODO: swap in c... | private TopGroups<String> searchShards(IndexSearcher topSearcher, ShardState shardState, Query query, Sort groupSort, Sort docSort, int groupOffset, int topNGroups, int docOffset,
int topNDocs, boolean getScores, boolean getMaxScores) throws Exception {
// TODO: swap in c... |
public synchronized void initServer() throws IOException
{
logger_.info("Cassandra version: " + FBUtilities.getReleaseVersionString());
logger_.info("Thrift API version: " + Constants.VERSION);
if (initialized)
{
if (isClientMode)
throw new Unsupporte... | public synchronized void initServer() throws IOException
{
logger_.info("Cassandra version: " + FBUtilities.getReleaseVersionString());
logger_.info("Thrift API version: " + Constants.VERSION);
if (initialized)
{
if (isClientMode)
throw new Unsupporte... |
private boolean syncReplicas(ZkController zkController, SolrCore core,
ZkNodeProps leaderProps) {
boolean success = false;
CloudDescriptor cloudDesc = core.getCoreDescriptor().getCloudDescriptor();
String collection = cloudDesc.getCollectionName();
String shardId = cloudDesc.getShardId();
i... | private boolean syncReplicas(ZkController zkController, SolrCore core,
ZkNodeProps leaderProps) {
boolean success = false;
CloudDescriptor cloudDesc = core.getCoreDescriptor().getCloudDescriptor();
String collection = cloudDesc.getCollectionName();
String shardId = cloudDesc.getShardId();
i... |
public boolean preloadRowCache = CFMetaData.DEFAULT_PRELOAD_ROW_CACHE;
} | public boolean preload_row_cache = CFMetaData.DEFAULT_PRELOAD_ROW_CACHE;
} |
public static Collection<KSMetaData> readTablesFromYaml() throws ConfigurationException
{
List<KSMetaData> defs = new ArrayList<KSMetaData>();
/* Read the table related stuff from config */
for (Keyspace keyspace : conf.keyspaces)
{
/* parsing out th... | public static Collection<KSMetaData> readTablesFromYaml() throws ConfigurationException
{
List<KSMetaData> defs = new ArrayList<KSMetaData>();
/* Read the table related stuff from config */
for (Keyspace keyspace : conf.keyspaces)
{
/* parsing out th... |
private static float explainToleranceDelta(float f1, float f2) {
return Math.max(f1, f2) * EXPLAIN_SCORE_TOLERANCE_DELTA;
}
| private static float explainToleranceDelta(float f1, float f2) {
return Math.max(Math.abs(f1), Math.abs(f2)) * EXPLAIN_SCORE_TOLERANCE_DELTA;
}
|
public void run() {
synchronized (scheduled) {
Throwable t = new TimeoutException();
state = State.Failed;
String[] missingDependecies = getMissingDepen... | public void run() {
synchronized (scheduled) {
Throwable t = new TimeoutException();
state = State.Failed;
String[] missingDependecies = getMissingDepen... |
public void testLongPostings() throws Exception {
// Don't use _TestUtil.getTempDir so that we own the
// randomness (ie same seed will point to same dir):
Directory dir = newFSDirectory(new File(LuceneTestCase.TEMP_DIR, "longpostings" + "." + random.nextLong()));
final int NUM_DOCS = (int) ((TEST_NI... | public void testLongPostings() throws Exception {
// Don't use _TestUtil.getTempDir so that we own the
// randomness (ie same seed will point to same dir):
Directory dir = newFSDirectory(_TestUtil.getTempDir("longpostings" + "." + random.nextLong()));
final int NUM_DOCS = (int) ((TEST_NIGHTLY ? 4e6 :... |
public void setUp() throws Exception {
super.setUp();
indexDir = new File(TEMP_DIR, "IndexReaderReopen");
}
| public void setUp() throws Exception {
super.setUp();
indexDir = _TestUtil.getTempDir("IndexReaderReopen");
}
|
public void setUp() throws Exception {
super.setUp();
tempDir = File.createTempFile("jrecrash", "tmp", TEMP_DIR);
tempDir.delete();
tempDir.mkdir();
}
| public void setUp() throws Exception {
super.setUp();
tempDir = _TestUtil.getTempDir("jrecrash");
tempDir.delete();
tempDir.mkdir();
}
|
public void testOpenReaderAfterDelete() throws IOException {
File dirFile = new File(TEMP_DIR, "deletetest");
Directory dir = newFSDirectory(dirFile);
try {
IndexReader.open(dir, false);
fail("expected FileNotFoundException");
} catch (FileNotFoundException e) {
// ex... | public void testOpenReaderAfterDelete() throws IOException {
File dirFile = _TestUtil.getTempDir("deletetest");
Directory dir = newFSDirectory(dirFile);
try {
IndexReader.open(dir, false);
fail("expected FileNotFoundException");
} catch (FileNotFoundException e) {
// ... |
public void testEmptyFSDirWithNoLock() throws Exception {
// Tests that if FSDir is opened w/ a NoLockFactory (or SingleInstanceLF),
// then IndexWriter ctor succeeds. Previously (LUCENE-2386) it failed
// when listAll() was called in IndexFileDeleter.
Directory dir = newFSDirectory(new File(TEMP_DIR... | public void testEmptyFSDirWithNoLock() throws Exception {
// Tests that if FSDir is opened w/ a NoLockFactory (or SingleInstanceLF),
// then IndexWriter ctor succeeds. Previously (LUCENE-2386) it failed
// when listAll() was called in IndexFileDeleter.
Directory dir = newFSDirectory(_TestUtil.getTemp... |
public void setUp() throws Exception {
super.setUp();
workDir = new File(TEMP_DIR, "TestMultiMMap");
workDir.mkdirs();
}
| public void setUp() throws Exception {
super.setUp();
workDir = _TestUtil.getTempDir("TestMultiMMap");
workDir.mkdirs();
}
|
public void testSetBufferSize() throws IOException {
File indexDir = new File(TEMP_DIR, "testSetBufferSize");
MockFSDirectory dir = new MockFSDirectory(indexDir, random);
try {
IndexWriter writer = new IndexWriter(
dir,
new IndexWriterConfig(TEST_VERSION_CURRENT, ne... | public void testSetBufferSize() throws IOException {
File indexDir = _TestUtil.getTempDir("testSetBufferSize");
MockFSDirectory dir = new MockFSDirectory(indexDir, random);
try {
IndexWriter writer = new IndexWriter(
dir,
new IndexWriterConfig(TEST_VERSION_CURRENT, ... |
public static void verifyExplanation(String q,
int doc,
float score,
boolean deep,
Explanation expl) {
float value = expl.getValue();
TestCase.assertEqu... | public static void verifyExplanation(String q,
int doc,
float score,
boolean deep,
Explanation expl) {
float value = expl.getValue();
TestCase.assertEqu... |
private static void process(Properties moduleList, String config,
File outputfile)
throws IOException
{
Properties outputProp = new Properties();
// copy this code from
// org.apache.derby.impl.services.monitor.BaseMonitor
//
for (Enumeration e = moduleList.propertyNames(); e.hasMoreElements... | private static void process(Properties moduleList, String config,
File outputfile)
throws IOException
{
Properties outputProp = new Properties();
// copy this code from
// org.apache.derby.impl.services.monitor.BaseMonitor
//
for (Enumeration e = moduleList.propertyNames(); e.hasMoreElements... |
private final SegmentReader origInstance;
FieldsReader fieldsReaderOrig;
TermVectorsReader termVectorsReaderOrig;
CompoundFileReader cfsReader;
CompoundFileReader storeCFSReader;
CoreReaders(SegmentReader origInstance, Directory dir, SegmentInfo si, int readBufferSize, int termsIndexDivisor) t... | private final SegmentReader origInstance;
FieldsReader fieldsReaderOrig;
TermVectorsReader termVectorsReaderOrig;
CompoundFileReader cfsReader;
CompoundFileReader storeCFSReader;
CoreReaders(SegmentReader origInstance, Directory dir, SegmentInfo si, int readBufferSize, int termsIndexDivisor) t... |
private void executeSet(CommonTree ast) throws TException, InvalidRequestException, UnavailableException
{
if (!CliMain.isConnected())
return;
int childCount = ast.getChildCount();
assert(childCount == 2);
CommonTree columnFamilySpec = (CommonTree)ast.getChild(0);
... | private void executeSet(CommonTree ast) throws TException, InvalidRequestException, UnavailableException
{
if (!CliMain.isConnected())
return;
int childCount = ast.getChildCount();
assert(childCount == 2);
CommonTree columnFamilySpec = (CommonTree)ast.getChild(0);
... |
private void getFileList(SolrParams solrParams, SolrQueryResponse rsp) {
String v = solrParams.get(GENERATION);
if (v == null) {
rsp.add("status", "no index generation specified");
return;
}
long gen = Long.parseLong(v);
IndexCommit commit = core.getDeletionPolicy().getCommitPoint(gen)... | private void getFileList(SolrParams solrParams, SolrQueryResponse rsp) {
String v = solrParams.get(GENERATION);
if (v == null) {
rsp.add("status", "no index generation specified");
return;
}
long gen = Long.parseLong(v);
IndexCommit commit = core.getDeletionPolicy().getCommitPoint(gen)... |
public String describeParams() {
StringBuffer sb = new StringBuffer();
sb.append("\t" + "maxQueryTerms : " + maxQueryTerms + "\n");
sb.append("\t" + "minWordLen : " + minWordLen + "\n");
sb.append("\t" + "maxWordLen : " + maxWordLen + "\n");
sb.append("\t" + "fieldNa... | public String describeParams() {
StringBuffer sb = new StringBuffer();
sb.append("\t" + "maxQueryTerms : " + maxQueryTerms + "\n");
sb.append("\t" + "minWordLen : " + minWordLen + "\n");
sb.append("\t" + "maxWordLen : " + maxWordLen + "\n");
sb.append("\t" + "fieldNa... |
public boolean hasNorms() {
for (FieldInfo fi : this) {
if (fi.isIndexed && !fi.omitNorms) {
return true;
}
}
| public boolean hasNorms() {
for (FieldInfo fi : this) {
if (fi.normsPresent()) {
return true;
}
}
|
public static MultiMapSolrParams parseQueryString(String queryString) {
Map<String,String[]> map = new HashMap<String, String[]>();
parseQueryString(queryString, "UTF-8", map);
return new MultiMapSolrParams(map);
}
/**
* Given a url-encoded query string, map it into the given map
* @param query... | public static MultiMapSolrParams parseQueryString(String queryString) {
Map<String,String[]> map = new HashMap<String, String[]>();
parseQueryString(queryString, "UTF-8", map);
return new MultiMapSolrParams(map);
}
/**
* Given a url-encoded query string, map it into the given map
* @param query... |
public void write(DataOutput out) throws IOException
{
if (rows.size() == 1 && !shouldPurge)
{
SSTableIdentityIterator row = rows.get(0);
out.writeLong(row.dataSize);
row.echoData(out);
return;
}
DataOutputBuffer clockOut = new Dat... | public void write(DataOutput out) throws IOException
{
if (rows.size() == 1 && !shouldPurge && rows.get(0).sstable.descriptor.isLatestVersion)
{
SSTableIdentityIterator row = rows.get(0);
out.writeLong(row.dataSize);
row.echoData(out);
return;
... |
public PrecompactedRow(ColumnFamilyStore cfStore, List<SSTableIdentityIterator> rows, boolean major, int gcBefore)
{
super(rows.get(0).getKey());
buffer = new DataOutputBuffer();
Set<SSTable> sstables = new HashSet<SSTable>();
for (SSTableIdentityIterator row : rows)
{
... | public PrecompactedRow(ColumnFamilyStore cfStore, List<SSTableIdentityIterator> rows, boolean major, int gcBefore)
{
super(rows.get(0).getKey());
buffer = new DataOutputBuffer();
Set<SSTable> sstables = new HashSet<SSTable>();
for (SSTableIdentityIterator row : rows)
{
... |
public String getVersion() {
return "1";
}
| public String getVersion() {
return "2";
}
|
public void testBasic() throws Exception {
// test using ZooKeeper
assertTrue("Not using ZooKeeper", h.getCoreContainer().isZooKeeperAware());
ZkController zkController = h.getCoreContainer().getZkController();
// test merge factor picked up
SolrCore core = h.getCore();
IndexWriter ... | public void testBasic() throws Exception {
// test using ZooKeeper
assertTrue("Not using ZooKeeper", h.getCoreContainer().isZooKeeperAware());
ZkController zkController = h.getCoreContainer().getZkController();
// test merge factor picked up
SolrCore core = h.getCore();
IndexWriter ... |
public void testSomeStuff() throws Exception {
// test merge factor picked up
SolrCore core = h.getCore();
IndexWriter writer = ((DirectUpdateHandler2)core.getUpdateHandler()).getIndexWriterProvider().getIndexWriter(core);
assertEquals("Mergefactor was not picked up", ((LogMergePolicy)writer.getConfi... | public void testSomeStuff() throws Exception {
// test merge factor picked up
SolrCore core = h.getCore();
IndexWriter writer = ((DirectUpdateHandler2)core.getUpdateHandler()).getSolrCoreState().getIndexWriter(core);
assertEquals("Mergefactor was not picked up", ((LogMergePolicy)writer.getConfig().ge... |
public void testLegacy() throws Exception {
IndexWriter writer = ((DirectUpdateHandler2)h.getCore().getUpdateHandler()).getIndexWriterProvider().getIndexWriter(h.getCore());
assertTrue(writer.getConfig().getMergePolicy().getClass().getName().equals(LogDocMergePolicy.class.getName()));
assertTrue(writer.ge... | public void testLegacy() throws Exception {
IndexWriter writer = ((DirectUpdateHandler2)h.getCore().getUpdateHandler()).getSolrCoreState().getIndexWriter(h.getCore());
assertTrue(writer.getConfig().getMergePolicy().getClass().getName().equals(LogDocMergePolicy.class.getName()));
assertTrue(writer.getConfi... |
public FuzzyTermEnum(IndexReader reader, Term term) throws IOException {
super(reader, term);
searchTerm = term;
field = searchTerm.field();
text = searchTerm.text();
textlen = text.length();
setEnum(reader.terms(new Term(searchTerm.field(), "")));
}
| public FuzzyTermEnum(IndexReader reader, Term term) throws IOException {
super();
searchTerm = term;
field = searchTerm.field();
text = searchTerm.text();
textlen = text.length();
setEnum(reader.terms(new Term(searchTerm.field(), "")));
}
|
public WildcardTermEnum(IndexReader reader, Term term) throws IOException {
super(reader, term);
searchTerm = term;
field = searchTerm.field();
text = searchTerm.text();
int sidx = text.indexOf(WILDCARD_STRING);
int cidx = text.indexOf(WILDCARD_CHAR);
int idx = sidx;
if (idx == -1) {
... | public WildcardTermEnum(IndexReader reader, Term term) throws IOException {
super();
searchTerm = term;
field = searchTerm.field();
text = searchTerm.text();
int sidx = text.indexOf(WILDCARD_STRING);
int cidx = text.indexOf(WILDCARD_CHAR);
int idx = sidx;
if (idx == -1) {
idx = ... |
public int setBytesX(long pos, byte[] bytes, int offset, int len) throws SqlException {
int length = 0;
/*
Check if position is less than 0 and if true
raise an exception
*/
if (pos <= 0L) {
throw new SqlException(agent_.logWrite... | public int setBytesX(long pos, byte[] bytes, int offset, int len) throws SqlException {
int length = 0;
/*
Check if position is less than 0 and if true
raise an exception
*/
if (pos <= 0L) {
throw new SqlException(agent_.logWrite... |
public void testRandom() throws Exception {
int numberOfRuns = _TestUtil.nextInt(random, 3, 6);
for (int iter = 0; iter < numberOfRuns; iter++) {
if (VERBOSE) {
System.out.println(String.format("TEST: iter=%d total=%d", iter, numberOfRuns));
}
final int numDocs = _TestUtil.nextInt(r... | public void testRandom() throws Exception {
int numberOfRuns = _TestUtil.nextInt(random, 3, 6);
for (int iter = 0; iter < numberOfRuns; iter++) {
if (VERBOSE) {
System.out.println(String.format("TEST: iter=%d total=%d", iter, numberOfRuns));
}
final int numDocs = _TestUtil.nextInt(r... |
public void assertStoredField(IndexableField leftField, IndexableField rightField) {
assertEquals(info, leftField.name(), rightField.name());
assertEquals(info, leftField.binaryValue(), rightField.binaryValue());
assertEquals(info, leftField.stringValue(), rightField.stringValue());
assertEquals(info,... | public void assertStoredField(IndexableField leftField, IndexableField rightField) {
assertEquals(info, leftField.name(), rightField.name());
assertEquals(info, leftField.binaryValue(), rightField.binaryValue());
assertEquals(info, leftField.stringValue(), rightField.stringValue());
assertEquals(info,... |
public void writeField(FieldInfo info, IndexableField field) throws IOException {
write(FIELD);
write(Integer.toString(info.number));
newLine();
write(NAME);
write(field.name());
newLine();
write(TYPE);
final NumericField.DataType numericType = field.numericDataType();
i... | public void writeField(FieldInfo info, IndexableField field) throws IOException {
write(FIELD);
write(Integer.toString(info.number));
newLine();
write(NAME);
write(field.name());
newLine();
write(TYPE);
final NumericField.DataType numericType = field.fieldType().numericType()... |
public void testABunchOfConvertedStuff() {
// these may be reused by things that need a special query
SolrQueryRequest req = null;
Map<String,String> args = new HashMap<String,String>();
lrf.args.put("version","2.0");
lrf.args.put("defType","lucenePlusSort");
// compact the index, keep things... | public void testABunchOfConvertedStuff() {
// these may be reused by things that need a special query
SolrQueryRequest req = null;
Map<String,String> args = new HashMap<String,String>();
lrf.args.put("version","2.0");
lrf.args.put("defType","lucenePlusSort");
// compact the index, keep things... |
protected void setup(Context context) throws IOException, InterruptedException {
super.setup(context);
Configuration conf = context.getConfiguration();
try {
ClassLoader ccl = Thread.currentThread().getContextClassLoader();
DistanceMeasure measure = ccl.loadClass(conf.get(KMeansConfigKeys.DIST... | protected void setup(Context context) throws IOException, InterruptedException {
super.setup(context);
Configuration conf = context.getConfiguration();
try {
ClassLoader ccl = Thread.currentThread().getContextClassLoader();
DistanceMeasure measure = ccl.loadClass(conf.get(KMeansConfigKeys.DIST... |
public void stop()
{
boolean OK = false;
if (rawStoreFactory != null)
{
DaemonService rawStoreDaemon = rawStoreFactory.getDaemon();
if (rawStoreDaemon != null)
rawStoreDaemon.stop();
}
long shutdownTime = System.currentTimeMillis();
boolean logBootTrace = PropertyUtil.getSystemBoolean(Prop... | public void stop()
{
boolean OK = false;
if (rawStoreFactory != null)
{
DaemonService rawStoreDaemon = rawStoreFactory.getDaemon();
if (rawStoreDaemon != null)
rawStoreDaemon.stop();
}
long shutdownTime = System.currentTimeMillis();
boolean logBootTrace = PropertyUtil.getSystemBoolean(Prop... |
public int run(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
addInputOption();
addOutputOption();
addOption("recommenderClassName", "r", "Name of recommender class to instantiate");
addOption("numRecommendations", "n", "Number of recommendations per user", "10");
... | public int run(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
addInputOption();
addOutputOption();
addOption("recommenderClassName", "r", "Name of recommender class to instantiate");
addOption("numRecommendations", "n", "Number of recommendations per user", "10");
... |
public float getDistance (String target, String other) {
char[] sa;
int n;
int p[]; //'previous' cost array, horizontally
int d[]; // cost array, horizontally
int _d[]; //placeholder to assist in swapping p and d
/*
The difference between this impl. and the pr... | public float getDistance (String target, String other) {
char[] sa;
int n;
int p[]; //'previous' cost array, horizontally
int d[]; // cost array, horizontally
int _d[]; //placeholder to assist in swapping p and d
/*
The difference between this impl. and the pr... |
public static Test suite() {
TestSuite suite = new TestSuite("Upgrade Suite");
for (int i = 0; i < OLD_VERSIONS.length; i++) {
// JSR169 support was only added with 10.1, so don't
// run 10.0 to later upgrade if that's what our jvm is supporting.
... | public static Test suite() {
TestSuite suite = new TestSuite("Upgrade Suite");
for (int i = 0; i < OLD_VERSIONS.length; i++) {
// JSR169 support was only added with 10.1, so don't
// run 10.0 to later upgrade if that's what our jvm is supporting.
... |
private void addPropertyParams(ZkNodeProps message, ModifiableSolrParams params) {
// Now add the property.key=value pairs
for (String key : message.keySet()) {
if (key.indexOf(COLL_PROP_PREFIX) != -1) {
params.set(key, message.getStr(key));
}
}
}
| private void addPropertyParams(ZkNodeProps message, ModifiableSolrParams params) {
// Now add the property.key=value pairs
for (String key : message.keySet()) {
if (key.startsWith(COLL_PROP_PREFIX)) {
params.set(key, message.getStr(key));
}
}
}
|
private void copyPropertiesIfNotNull(SolrParams params, Map<String, Object> props) {
Iterator<String> iter = params.getParameterNamesIterator();
while (iter.hasNext()) {
String param = iter.next();
if (param.indexOf(OverseerCollectionProcessor.COLL_PROP_PREFIX) != -1) {
props.put(param, p... | private void copyPropertiesIfNotNull(SolrParams params, Map<String, Object> props) {
Iterator<String> iter = params.getParameterNamesIterator();
while (iter.hasNext()) {
String param = iter.next();
if (param.startsWith(OverseerCollectionProcessor.COLL_PROP_PREFIX)) {
props.put(param, para... |
public TestSameRandomnessLocalePassedOrNot() {
super(false);
}
| public TestSameRandomnessLocalePassedOrNot() {
super(true);
}
|
public DataSource getDataSource(String name) {
return dataImporter.getDataSourceInstance(entity);
}
| public DataSource getDataSource(String name) {
return dataImporter.getDataSourceInstance(entity, name, this);
}
|
public void testBlobCreateLocatorSP() throws SQLException {
//initialize the locator to a default value.
int locator = -1;
//call the stored procedure to return the created locator.
CallableStatement cs = prepareCall
("? = CALL SYSIBM.BLOBCREATELOCATOR()");
cs.re... | public void testBlobCreateLocatorSP() throws SQLException {
//initialize the locator to a default value.
int locator = -1;
//call the stored procedure to return the created locator.
CallableStatement cs = prepareCall
("? = CALL SYSIBM.BLOBCREATELOCATOR()");
cs.re... |
private SSTableReader writeSortedContents() throws IOException
{
logger.info("Writing " + this);
SSTableWriter writer = cfs.createFlushWriter(columnFamilies.size());
for (Map.Entry<DecoratedKey, ColumnFamily> entry : columnFamilies.entrySet())
writer.append(entry.getKey(), e... | private SSTableReader writeSortedContents() throws IOException
{
logger.info("Writing " + this);
SSTableWriter writer = new SSTableWriter(cfs.getFlushPath(), columnFamilies.size(), cfs.metadata, cfs.partitioner);
for (Map.Entry<DecoratedKey, ColumnFamily> entry : columnFamilies.entrySet... |
public void setTransactionId(GlobalTransactionId extid, TransactionId localid) {
if (SanityManager.DEBUG) {
//SanityManager.ASSERT(myGlobalId == null, "my globalId is not null");
if (!(state == IDLE || state == Xact.ACTIVE ||
(state== CLOSED && justCreated)))
{
... | public LogInstant getLastLogInstant()
{
return logLast;
}
/**
Set my transaction identifier.
*/
void setTransactionId(GlobalTransactionId extid, TransactionId localid) {
if (SanityManager.DEBUG) {
//SanityManager.ASSERT(myGlobalId == null, "my globalId is not null");
if (!(state == IDLE ||... |
public void testAlternateLocation() throws Exception {
String[] ALT_DOCS = new String[]{
"jumpin jack flash",
"Sargent Peppers Lonely Hearts Club Band",
"Born to Run",
"Thunder Road",
"Londons Burning",
"A Horse with No Name",
"Sw... | public void testAlternateLocation() throws Exception {
String[] ALT_DOCS = new String[]{
"jumpin jack flash",
"Sargent Peppers Lonely Hearts Club Band",
"Born to Run",
"Thunder Road",
"Londons Burning",
"A Horse with No Name",
"Sw... |
protected void doFieldSortValues(ResponseBuilder rb, SolrIndexSearcher searcher) throws IOException
{
SolrQueryRequest req = rb.req;
SolrQueryResponse rsp = rb.rsp;
final CharsRef spare = new CharsRef();
// The query cache doesn't currently store sort field values, and SolrIndexSearcher doesn't
... | protected void doFieldSortValues(ResponseBuilder rb, SolrIndexSearcher searcher) throws IOException
{
SolrQueryRequest req = rb.req;
SolrQueryResponse rsp = rb.rsp;
final CharsRef spare = new CharsRef();
// The query cache doesn't currently store sort field values, and SolrIndexSearcher doesn't
... |
private static void addDoc(RandomIndexWriter iw, int i) throws Exception {
Document d = new Document();
Field f;
int scoreAndID = i + 1;
FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
customType.setOmitNorms(true);
f = newField(ID_FIELD, ... | private static void addDoc(RandomIndexWriter iw, int i) throws Exception {
Document d = new Document();
Field f;
int scoreAndID = i + 1;
FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
customType.setOmitNorms(true);
f = newField(ID_FIELD, ... |
protected final void indexDoc(FacetIndexingParams iParams, RandomIndexWriter iw,
TaxonomyWriter tw, String content, List<CategoryPath> categories) throws IOException,
CorruptIndexException {
Document d = new Document();
CategoryDocumentBuilder builder = new CategoryDocumentBuilder(tw, iParams);
... | protected final void indexDoc(FacetIndexingParams iParams, RandomIndexWriter iw,
TaxonomyWriter tw, String content, List<CategoryPath> categories) throws IOException,
CorruptIndexException {
Document d = new Document();
CategoryDocumentBuilder builder = new CategoryDocumentBuilder(tw, iParams);
... |
private void prvt_add(DefaultFacetIndexingParams iParams, RandomIndexWriter iw,
TaxonomyWriter tw, String... strings) throws IOException,
CorruptIndexException {
ArrayList<CategoryPath> cps = new ArrayList<CategoryPath>();
CategoryPath cp = new CategoryPath(strings);
cps.add(cp);... | private void prvt_add(DefaultFacetIndexingParams iParams, RandomIndexWriter iw,
TaxonomyWriter tw, String... strings) throws IOException,
CorruptIndexException {
ArrayList<CategoryPath> cps = new ArrayList<CategoryPath>();
CategoryPath cp = new CategoryPath(strings);
cps.add(cp);... |
public CategoryDocumentBuilder setCategories(
Iterable<CategoryAttribute> categories) throws IOException {
fieldList.clear();
if (categories == null) {
return this;
}
// get field-name to a list of facets mapping as different facets could
// be added to different category-lists on dif... | public CategoryDocumentBuilder setCategories(
Iterable<CategoryAttribute> categories) throws IOException {
fieldList.clear();
if (categories == null) {
return this;
}
// get field-name to a list of facets mapping as different facets could
// be added to different category-lists on dif... |
public void testEndOffsetPositionWithTeeSinkTokenFilter() throws Exception {
Directory dir = newDirectory();
Analyzer analyzer = new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false);
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
Document doc = new D... | public void testEndOffsetPositionWithTeeSinkTokenFilter() throws Exception {
Directory dir = newDirectory();
Analyzer analyzer = new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false);
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
Document doc = new D... |
public void run() {
try {
DirectoryReader open = null;
for (int i = 0; i < num; i++) {
Document doc = new Document();// docs.nextDoc();
doc.add(newField("id", "test", StringField.TYPE_UNSTORED));
writer.updateDocument(new Term("id", "test"), doc);
if (ra... | public void run() {
try {
DirectoryReader open = null;
for (int i = 0; i < num; i++) {
Document doc = new Document();// docs.nextDoc();
doc.add(newStringField("id", "test", Field.Store.NO));
writer.updateDocument(new Term("id", "test"), doc);
if (random(... |
private void addDocs(IndexWriter writer, int numDocs, boolean withID) throws IOException {
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
if (withID) {
doc.add(new Field("id", "" + i, StringField.TYPE_UNSTORED));
}
writer.addDocument(doc);
}
writer.commi... | private void addDocs(IndexWriter writer, int numDocs, boolean withID) throws IOException {
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
if (withID) {
doc.add(new StringField("id", "" + i, Field.Store.NO));
}
writer.addDocument(doc);
}
writer.commit();
... |
public void run() {
DirectoryReader currentReader = null;
Random random = LuceneTestCase.random();
try {
Document doc = new Document();
doc.add(new Field("id", "1", TextField.TYPE_UNSTORED));
writer.addDocument(doc);
holder.reader = currentReader = writer.getReader(... | public void run() {
DirectoryReader currentReader = null;
Random random = LuceneTestCase.random();
try {
Document doc = new Document();
doc.add(new TextField("id", "1", Field.Store.NO));
writer.addDocument(doc);
holder.reader = currentReader = writer.getReader(true)... |
public void index(IndexWriter writer,
Type valueType, long[] values, Type[] sourceTypes, int offset, int num)
throws CorruptIndexException, IOException {
final Field valField;
if (VERBOSE) {
System.out.println("TEST: add docs " + offset + "-" + (offset+num) + " valType=" + valueType);
}... | public void index(IndexWriter writer,
Type valueType, long[] values, Type[] sourceTypes, int offset, int num)
throws CorruptIndexException, IOException {
final Field valField;
if (VERBOSE) {
System.out.println("TEST: add docs " + offset + "-" + (offset+num) + " valType=" + valueType);
}... |
public void run() {
try {
Document doc = new Document();
Field field = newField("field", "testData", TextField.TYPE_STORED);
doc.add(field);
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random())));
... | public void run() {
try {
Document doc = new Document();
Field field = newTextField("field", "testData", Field.Store.YES);
doc.add(field);
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random())));
... |
public void test() throws Exception {
MockDirectoryWrapper dir = newFSDirectory(_TestUtil.getTempDir("2BPostings"));
dir.setThrottling(MockDirectoryWrapper.Throttling.NEVER);
dir.setCheckIndexOnClose(false); // don't double-checkindex
IndexWriter w = new IndexWriter(dir,
new IndexWriterCo... | public void test() throws Exception {
MockDirectoryWrapper dir = newFSDirectory(_TestUtil.getTempDir("2BPostings"));
dir.setThrottling(MockDirectoryWrapper.Throttling.NEVER);
dir.setCheckIndexOnClose(false); // don't double-checkindex
IndexWriter w = new IndexWriter(dir,
new IndexWriterCo... |
public void testNGramPrefixGridLosAngeles() throws IOException {
SimpleSpatialFieldInfo fieldInfo = new SimpleSpatialFieldInfo("geo");
SpatialContext ctx = SimpleSpatialContext.GEO_KM;
TermQueryPrefixTreeStrategy prefixGridStrategy = new TermQueryPrefixTreeStrategy(new QuadPrefixTree(ctx));
Shape poi... | public void testNGramPrefixGridLosAngeles() throws IOException {
SimpleSpatialFieldInfo fieldInfo = new SimpleSpatialFieldInfo("geo");
SpatialContext ctx = SimpleSpatialContext.GEO_KM;
TermQueryPrefixTreeStrategy prefixGridStrategy = new TermQueryPrefixTreeStrategy(new QuadPrefixTree(ctx));
Shape poi... |
public IndexableField createDouble( String name, double v ) {
if (!store && !index)
throw new IllegalArgumentException("field must be indexed or stored");
FieldType fieldType = new FieldType(DoubleField.TYPE);
fieldType.setStored(store);
fieldType.setIndexed(index);
fieldType.setNumericPrec... | public IndexableField createDouble( String name, double v ) {
if (!store && !index)
throw new IllegalArgumentException("field must be indexed or stored");
FieldType fieldType = new FieldType(DoubleField.TYPE_NOT_STORED);
fieldType.setStored(store);
fieldType.setIndexed(index);
fieldType.set... |
public NGramTokenFilter create(TokenStream input) {
return new NGramTokenFilter(input, minGramSize, maxGramSize);
}
| public NGramTokenFilter create(TokenStream input) {
return new NGramTokenFilter(luceneMatchVersion, input, minGramSize, maxGramSize);
}
|
public void merge(MergeState mergeState) throws IOException {
final DocValues[] docValues = new DocValues[mergeState.readers.size()];
for (FieldInfo fieldInfo : mergeState.fieldInfos) {
mergeState.fieldInfo = fieldInfo; // set the field we are merging
if (canMerge(fieldInfo)) {
for (int i... | public void merge(MergeState mergeState) throws IOException {
final DocValues[] docValues = new DocValues[mergeState.readers.size()];
for (FieldInfo fieldInfo : mergeState.fieldInfos) {
mergeState.fieldInfo = fieldInfo; // set the field we are merging
if (canMerge(fieldInfo)) {
for (int i... |
public Row getRow(QueryFilter filter) throws IOException
{
ColumnFamilyStore cfStore = columnFamilyStores_.get(filter.getColumnFamilyName());
ColumnFamily columnFamily = cfStore.getColumnFamily(filter);
return new Row(filter.key, columnFamily);
}
/**
* This method adds the ... | public Row getRow(QueryFilter filter) throws IOException
{
ColumnFamilyStore cfStore = columnFamilyStores_.get(filter.getColumnFamilyName());
ColumnFamily columnFamily = cfStore.getColumnFamily(filter);
return new Row(filter.key, columnFamily);
}
/**
* This method adds the ... |
protected Reader initReader(Reader reader) {
return new PatternReplaceCharFilter(p, replacement, CharReader.get(reader));
}
};
/* max input length. don't make it longer -- exponential processing
* time for certain patterns. */
final int maxInputLength = 30;
/* ... | protected Reader initReader(String fieldName, Reader reader) {
return new PatternReplaceCharFilter(p, replacement, CharReader.get(reader));
}
};
/* max input length. don't make it longer -- exponential processing
* time for certain patterns. */
final int maxInputLeng... |
protected Reader initReader(Reader reader) {
return new PersianCharFilter(CharReader.get(reader));
}
} | protected Reader initReader(String fieldName, Reader reader) {
return new PersianCharFilter(CharReader.get(reader));
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.