buggy_function stringlengths 1 391k | fixed_function stringlengths 0 392k |
|---|---|
public int compare(String o1, String o2)
{
return dc.compare(partitioner.decorateKey(o1), partitioner.decorateKey(o2));
}
});
DataOutputBuffer buffer = new DataOutputBuffer();
for (String key : orderedKeys)
{
buffer.reset();... | public int compare(String o1, String o2)
{
return dc.compare(partitioner.decorateKey(o1), partitioner.decorateKey(o2));
}
});
DataOutputBuffer buffer = new DataOutputBuffer();
for (String key : orderedKeys)
{
buffer.reset();... |
protected double getScoreForLabelInstance(int label, Vector instance) {
double result = 0.0;
Iterator<Element> elements = instance.iterateNonZero();
while (elements.hasNext()) {
Element e = elements.next();
result += e.get() * getScoreForLabelFeature(label, e.index());
}
return -result... | protected double getScoreForLabelInstance(int label, Vector instance) {
double result = 0.0;
Iterator<Element> elements = instance.iterateNonZero();
while (elements.hasNext()) {
Element e = elements.next();
result += e.get() * getScoreForLabelFeature(label, e.index());
}
return result;... |
protected void waitForRecoveriesToFinish(String collection,
ZkStateReader zkStateReader, boolean verbose, boolean failOnTimeout, int timeoutSeconds)
throws Exception {
log.info("Wait for recoveries to finish - collection: " + collection + " failOnTimeout:" + failOnTimeout + " timeout (sec):" + timeout... | protected void waitForRecoveriesToFinish(String collection,
ZkStateReader zkStateReader, boolean verbose, boolean failOnTimeout, int timeoutSeconds)
throws Exception {
log.info("Wait for recoveries to finish - collection: " + collection + " failOnTimeout:" + failOnTimeout + " timeout (sec):" + timeout... |
private void stream() throws IOException
{
ByteBuffer HeaderBuffer = MessagingService.instance().constructStreamHeader(header, false, Gossiper.instance.getVersion(to));
// write header (this should not be compressed for compatibility with other messages)
output.write(ByteBufferUtil.getAr... | private void stream() throws IOException
{
ByteBuffer HeaderBuffer = MessagingService.instance().constructStreamHeader(header, false, Gossiper.instance.getVersion(to));
// write header (this should not be compressed for compatibility with other messages)
output.write(ByteBufferUtil.getAr... |
public int getGroupedFacetQueryCount(Query facetQuery) throws IOException {
GroupingSpecification groupingSpecification = rb.getGroupingSpec();
String groupField = groupingSpecification != null ? groupingSpecification.getFields()[0] : null;
if (groupField == null) {
throw new SolrException (
... | public int getGroupedFacetQueryCount(Query facetQuery) throws IOException {
GroupingSpecification groupingSpecification = rb.getGroupingSpec();
String groupField = groupingSpecification != null ? groupingSpecification.getFields()[0] : null;
if (groupField == null) {
throw new SolrException (
... |
public void testEarlyEndOfFile() throws Exception {
Connection c = getConnection();
try {
doImportFromFile(c, "extin/EndOfFile.txt" , "T4" , null , null , null, 0);
} catch (SQLException e) {
// DERBY-1440: JDBC 4 client driver doesn't include nested exception SQLStates
assertSQLState(JDBC.vmSupportsJDB... | public void testEarlyEndOfFile() throws Exception {
Connection c = getConnection();
try {
doImportFromFile(c, "extin/EndOfFile.txt" , "T4" , null , null , null, 0);
} catch (SQLException e) {
// DERBY-1440: JDBC 4 client driver doesn't include nested exception SQLStates
assertSQLState(JDBC.vmSupportsJDB... |
protected void reduce(WritableComparable<?> key, Iterable<VectorWritable> values, Context context)
throws IOException, InterruptedException {
Iterator<VectorWritable> it = values.iterator();
if (!it.hasNext()) {
return;
}
Vector value = it.next().get();
Iterator<Vector.Element> it1 = val... | protected void reduce(WritableComparable<?> key, Iterable<VectorWritable> values, Context context)
throws IOException, InterruptedException {
Iterator<VectorWritable> it = values.iterator();
if (!it.hasNext()) {
return;
}
Vector value = it.next().get();
Iterator<Vector.Element> it1 = val... |
public void run() {
agentContext.unregisterMBean(getName());
}
});
trackedId = null;
context.ungetService(reference);
}
}
| public void run() {
agentContext.unregisterMBean(AbstractCompendiumHandler.this);
}
});
trackedId = null;
context.ungetService(reference);
}
}
|
public void testFSDirectoryReopen2() throws CorruptIndexException, IOException {
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir == null)
throw new IOException("java.io.tmpdir undefined, cannot run test");
File indexDir2 = new File(tempDir, "IndexReaderReopen2");
Directory d... | public void testFSDirectoryReopen2() throws CorruptIndexException, IOException {
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir == null)
throw new IOException("java.io.tmpdir undefined, cannot run test");
File indexDir2 = new File(tempDir, "IndexReaderReopen2");
Directory d... |
public void testExactFileNames() throws IOException {
for(int pass=0;pass<2;pass++) {
String outputDir = "lucene.backwardscompat0.index";
rmDir(outputDir);
try {
Directory dir = FSDirectory.getDirectory(fullDir(outputDir));
boolean autoCommit = 0 == pass;
IndexWrite... | public void testExactFileNames() throws IOException {
for(int pass=0;pass<2;pass++) {
String outputDir = "lucene.backwardscompat0.index";
rmDir(outputDir);
try {
Directory dir = FSDirectory.getDirectory(fullDir(outputDir));
boolean autoCommit = 0 == pass;
IndexWrite... |
private void assertNoPrx(Directory dir) throws Throwable {
final String[] files = dir.list();
for(int i=0;i<files.length;i++)
| private void assertNoPrx(Directory dir) throws Throwable {
final String[] files = dir.listAll();
for(int i=0;i<files.length;i++)
|
public IndexConstantAction getIndexAction() { return indexAction; }
/**
* Make sure that the foreign key constraint is valid
* with the existing data in the target table. Open
* the table, if there aren't any rows, ok. If there
* are rows, open a scan on the referenced key with
* table locking at leve... | public IndexConstantAction getIndexAction() { return indexAction; }
/**
* Make sure that the foreign key constraint is valid
* with the existing data in the target table. Open
* the table, if there aren't any rows, ok. If there
* are rows, open a scan on the referenced key with
* table locking at leve... |
public int hashCode() {
return 0x45aaf665 + Arrays.hashCode(fields);
}
/** Whether the relevance score is needed to sort documents. */
boolean needsScores() {
for (SortField sortField : fields) {
if (sortField.getType() == SortField.Type.SCORE) {
return true;
}
}
return fals... | public int hashCode() {
return 0x45aaf665 + Arrays.hashCode(fields);
}
/** Whether the relevance score is needed to sort documents. */
boolean needsScores() {
for (SortField sortField : fields) {
if (sortField.needsScores()) {
return true;
}
}
return false;
}
|
public MySQLJDBCDataModel(DataSource dataSource,
String preferenceTable,
String userIDColumn,
String itemIDColumn,
String preferenceColumn) {
super(dataSource,
preferenceTable,
userI... | public MySQLJDBCDataModel(DataSource dataSource,
String preferenceTable,
String userIDColumn,
String itemIDColumn,
String preferenceColumn) {
super(dataSource,
preferenceTable,
userI... |
public static String escape(String s) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
// These characters are part of the query syntax and must be escaped
if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')'
... | public static String escape(String s) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
// These characters are part of the query syntax and must be escaped
if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')'
... |
private void createCollection(ClusterState clusterState, ZkNodeProps message, NamedList results) throws KeeperException, InterruptedException {
String collectionName = message.getStr("name");
if (clusterState.getCollections().contains(collectionName)) {
throw new SolrException(ErrorCode.BAD_REQUEST, "co... | private void createCollection(ClusterState clusterState, ZkNodeProps message, NamedList results) throws KeeperException, InterruptedException {
String collectionName = message.getStr("name");
if (clusterState.getCollections().contains(collectionName)) {
throw new SolrException(ErrorCode.BAD_REQUEST, "co... |
private static List<org.apache.cassandra.db.Row> getSlice(String keyspace, SelectStatement select)
throws InvalidRequestException, TimedOutException, UnavailableException
{
List<org.apache.cassandra.db.Row> rows = null;
QueryPath queryPath = new QueryPath(select.getColumnFamily());
L... | private static List<org.apache.cassandra.db.Row> getSlice(String keyspace, SelectStatement select)
throws InvalidRequestException, TimedOutException, UnavailableException
{
List<org.apache.cassandra.db.Row> rows = null;
QueryPath queryPath = new QueryPath(select.getColumnFamily());
L... |
private int mergeMiddle(MergePolicy.OneMerge merge)
throws CorruptIndexException, IOException {
merge.checkAborted(directory);
final String mergedName = merge.info.name;
int mergedDocCount = 0;
SegmentInfos sourceSegments = merge.segments;
SegmentMerger merger = new SegmentMerger(... | private int mergeMiddle(MergePolicy.OneMerge merge)
throws CorruptIndexException, IOException {
merge.checkAborted(directory);
final String mergedName = merge.info.name;
int mergedDocCount = 0;
SegmentInfos sourceSegments = merge.segments;
SegmentMerger merger = new SegmentMerger(... |
public IndexException(int index, int cardinality) {
super("Index " + index + " is outside allowable range of [0," + cardinality + ']');
}
| public IndexException(int index, int cardinality) {
super("Index " + index + " is outside allowable range of [0," + cardinality + ')');
}
|
public CoreDescriptor(CoreContainer coreContainer, String name, String instanceDir) {
this.coreContainer = coreContainer;
this.name = name;
if(coreContainer.getZkController() != null) {
this.cloudDesc = new CloudDescriptor();
// cloud collection defaults to core name
cloudDesc.setCo... | public CoreDescriptor(CoreContainer coreContainer, String name, String instanceDir) {
this.coreContainer = coreContainer;
this.name = name;
if(coreContainer.getZkController() != null) {
this.cloudDesc = new CloudDescriptor();
// cloud collection defaults to core name
cloudDesc.setCo... |
public SpellCheckResponse(NamedList<Object> spellInfo) {
NamedList<Object> sugg = (NamedList<Object>) spellInfo.get("suggestions");
if (sugg == null) {
correctlySpelled = true;
return;
}
for (int i = 0; i < sugg.size(); i++) {
String n = sugg.getName(i);
if ("correctlySpelled".... | public SpellCheckResponse(NamedList<Object> spellInfo) {
NamedList<Object> sugg = (NamedList<Object>) spellInfo.get("suggestions");
if (sugg == null) {
correctlySpelled = true;
return;
}
for (int i = 0; i < sugg.size(); i++) {
String n = sugg.getName(i);
if ("correctlySpelled".... |
private void getSampleData(String[] docs2) throws IOException {
System.out.println();
sampleData = Lists.newArrayList();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter( directory, new IndexWriterConfig(Version.LUCENE_41,new StandardAnalyzer(Version.LUCENE_41)));
| private void getSampleData(String[] docs2) throws IOException {
System.out.println();
sampleData = Lists.newArrayList();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter( directory, new IndexWriterConfig(Version.LUCENE_42,new StandardAnalyzer(Version.LUCENE_42)));
|
public void test() throws Exception {
IndexReader reader = DirectoryReader.open(directory);
CachedTermInfo cti = new CachedTermInfo(reader, "content", 0, 100);
assertEquals(3, cti.totalTerms("content"));
assertNotNull(cti.getTermEntry("content", "a"));
assertNull(cti.getTermEntry("content", "e"));... | public void test() throws Exception {
IndexReader reader = DirectoryReader.open(directory);
CachedTermInfo cti = new CachedTermInfo(reader, "content", 0, 100);
assertEquals(3, cti.totalTerms("content"));
assertNotNull(cti.getTermEntry("content", "a"));
assertNull(cti.getTermEntry("content", "e"));... |
public void testIterableSomeNoiseTermVectors() throws IOException {
//get noise vectors
RAMDirectory directory = createTestIndex(Field.TermVector.YES, new RAMDirectory(), true, 0);
//get real vectors
createTestIndex(Field.TermVector.NO, directory, false, 5);
IndexReader reader = DirectoryReader.op... | public void testIterableSomeNoiseTermVectors() throws IOException {
//get noise vectors
RAMDirectory directory = createTestIndex(Field.TermVector.YES, new RAMDirectory(), true, 0);
//get real vectors
createTestIndex(Field.TermVector.NO, directory, false, 5);
IndexReader reader = DirectoryReader.op... |
public AnalyzerTransformer() {
this(new StandardAnalyzer(Version.LUCENE_41), "text");
}
| public AnalyzerTransformer() {
this(new StandardAnalyzer(Version.LUCENE_42), "text");
}
|
public void testLuceneEncoding() throws Exception {
LuceneTextValueEncoder enc = new LuceneTextValueEncoder("text");
enc.setAnalyzer(new WhitespaceAnalyzer(Version.LUCENE_41));
Vector v1 = new DenseVector(200);
enc.addToVector("test1 and more", v1);
enc.flush(1, v1);
//should be the same as t... | public void testLuceneEncoding() throws Exception {
LuceneTextValueEncoder enc = new LuceneTextValueEncoder("text");
enc.setAnalyzer(new WhitespaceAnalyzer(Version.LUCENE_42));
Vector v1 = new DenseVector(200);
enc.addToVector("test1 and more", v1);
enc.flush(1, v1);
//should be the same as t... |
public AbstractVisitingPrefixTreeFilter(Shape queryShape, String fieldName, SpatialPrefixTree grid,
int detailLevel, int prefixGridScanLevel) {
super(queryShape, fieldName, grid, detailLevel);
this.prefixGridScanLevel = Math.max(1, Math.min(prefixGridScanLevel, grid.g... | public AbstractVisitingPrefixTreeFilter(Shape queryShape, String fieldName, SpatialPrefixTree grid,
int detailLevel, int prefixGridScanLevel) {
super(queryShape, fieldName, grid, detailLevel);
this.prefixGridScanLevel = Math.max(0, Math.min(prefixGridScanLevel, grid.g... |
public static String escapeQueryChars(String s) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
// These characters are part of the query syntax and must be escaped
if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')... | public static String escapeQueryChars(String s) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
// These characters are part of the query syntax and must be escaped
if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')... |
public AriesApplication createApplication(IDirectory ebaFile) throws ManagementException {
ApplicationMetadata applicationMetadata = null;
DeploymentMetadata deploymentMetadata = null;
Map<String, InputStream> modifiedBundles = new HashMap<String, InputStream>();
AriesApplicationImpl application = nul... | public AriesApplication createApplication(IDirectory ebaFile) throws ManagementException {
ApplicationMetadata applicationMetadata = null;
DeploymentMetadata deploymentMetadata = null;
Map<String, InputStream> modifiedBundles = new HashMap<String, InputStream>();
AriesApplicationImpl application = nul... |
public CostEstimate optimizeIt(
Optimizer optimizer,
OptimizablePredicateList predList,
CostEstimate outerCost,
RowOrdering rowOrdering)
throws StandardException
{
/*
** RESOLVE: Most types of Optimizables only implement estimateCost(),
** and leave it up to optimizeIt() in FromTa... | public CostEstimate optimizeIt(
Optimizer optimizer,
OptimizablePredicateList predList,
CostEstimate outerCost,
RowOrdering rowOrdering)
throws StandardException
{
/*
** RESOLVE: Most types of Optimizables only implement estimateCost(),
** and leave it up to optimizeIt() in FromTa... |
public UUID getVersion()
{
return newVersion;
}
/**
* Definitions are serialized as a row with a UUID key, with a magical column named DEFINITION_SCHEMA_COLUMN_NAME
* (containing the Avro Schema) and a column per keyspace. Each keyspace column contains a avro.KsDef object
* encod... | public UUID getVersion()
{
return newVersion;
}
/**
* Definitions are serialized as a row with a UUID key, with a magical column named DEFINITION_SCHEMA_COLUMN_NAME
* (containing the Avro Schema) and a column per keyspace. Each keyspace column contains a avro.KsDef object
* encod... |
private static boolean sendMessage(InetAddress endPoint, String tableName, String key) throws IOException
{
if (!Gossiper.instance.isKnownEndpoint(endPoint))
{
logger_.warn("Hints found for endpoint " + endPoint + " which is not part of the gossip network. discarding.");
... | private static boolean sendMessage(InetAddress endPoint, String tableName, String key) throws IOException
{
if (!Gossiper.instance.isKnownEndpoint(endPoint))
{
logger_.warn("Hints found for endpoint " + endPoint + " which is not part of the gossip network. discarding.");
... |
String LOCK_TIMEOUT_LOG = "40XL1.T.1";
/*
Derby - Class org.apache.derby.shared.common.reference.SQLState
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright owner... | String LOCK_TIMEOUT_LOG = "40XL1.T.1";
/*
Derby - Class org.apache.derby.shared.common.reference.SQLState
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright owner... |
public void inform(SolrCore core) {
if (initParams != null) {
LOG.info("Initializing spell checkers");
boolean hasDefault = false;
for (int i = 0; i < initParams.size(); i++) {
if (initParams.getName(i).equals("spellchecker")) {
NamedList spellchecker = (NamedList) initParams.g... | public void inform(SolrCore core) {
if (initParams != null) {
LOG.info("Initializing spell checkers");
boolean hasDefault = false;
for (int i = 0; i < initParams.size(); i++) {
if (initParams.getName(i).equals("spellchecker")) {
NamedList spellchecker = (NamedList) initParams.g... |
public final java.sql.ResultSet getGeneratedKeys() throws SQLException {
checkStatus();
if (autoGeneratedKeysResultSet == null)
return null;
else {
execute("VALUES IDENTITY_VAL_LOCAL()", true, false, JDBC30Translation.NO_GENERATED_KEYS, null, null);
return results;
}
}
/////////////////////////////... | public final java.sql.ResultSet getGeneratedKeys() throws SQLException {
checkStatus();
if (autoGeneratedKeysResultSet == null)
return null;
else {
execute("VALUES IDENTITY_VAL_LOCAL()", true, false, JDBC30Translation.NO_GENERATED_KEYS, null, null);
return results;
}
}
/////////////////////////////... |
public Object run() {
checkRoot();
State state = target.getState();
if (EnumSet.of(State.INSTALLED, State.RESOLVED).contains(state))
return null;
else if (EnumSet.of(State.INSTALL_FAILED, State.UNINSTALLING, State.UNINSTALLED).contains(state))
throw new IllegalStateException("Cannot stop from state " + s... | public Object run() {
checkRoot();
State state = target.getState();
if (EnumSet.of(State.INSTALLED, State.RESOLVED).contains(state))
return null;
else if (EnumSet.of(State.INSTALL_FAILED, State.UNINSTALLING, State.UNINSTALLED).contains(state))
throw new IllegalStateException("Cannot stop from state " + s... |
public Object run() {
checkValid();
checkRoot();
State state = target.getState();
if (EnumSet.of(State.UNINSTALLED).contains(state))
return null;
else if (EnumSet.of(State.INSTALL_FAILED, State.INSTALLING, State.RESOLVING, State.STARTING, State.STOPPING, State.UNINSTALLING).contains(state)) {
waitForSt... | public Object run() {
checkValid();
checkRoot();
State state = target.getState();
if (EnumSet.of(State.UNINSTALLED).contains(state))
return null;
else if (EnumSet.of(State.INSTALL_FAILED, State.INSTALLING, State.RESOLVING, State.STARTING, State.STOPPING, State.UNINSTALLING).contains(state)) {
waitForSt... |
public Object run() {
State state = target.getState();
// The following states are illegal.
if (EnumSet.of(State.INSTALL_FAILED, State.UNINSTALLED, State.UNINSTALLING).contains(state))
throw new SubsystemException("Cannot stop from state " + state);
// The following states must wait.
if (EnumSet.of(State.... | public Object run() {
State state = target.getState();
// The following states are illegal.
if (EnumSet.of(State.INSTALL_FAILED, State.UNINSTALLED, State.UNINSTALLING).contains(state))
throw new SubsystemException("Cannot stop from state " + state);
// The following states must wait.
if (EnumSet.of(State.... |
public void clean(boolean forRemove) throws StandardException
{
boolean waited = false;
// If interrupt recovery is in progress (NIO), we must expect to
// release our monitor on "this" and to retry writeRAFHeader, so be
// prepared to retry.
boolean success = false;
int max... | public void clean(boolean forRemove) throws StandardException
{
boolean waited = false;
// If interrupt recovery is in progress (NIO), we must expect to
// release our monitor on "this" and to retry writeRAFHeader, so be
// prepared to retry.
boolean success = false;
int max... |
private final static String STORAGE_CONF_FILE = "storage-conf.xml";
/**
* Try the storage-config system property, and then inspect the classpath.
*/
static String getStorageConfigPath()
{
String scp = System.getProperty("storage-config") + File.separator + STORAGE_CONF_FILE;
i... | private final static String STORAGE_CONF_FILE = "storage-conf.xml";
/**
* Try the storage-config system property, and then inspect the classpath.
*/
static String getStorageConfigPath()
{
String scp = System.getProperty("storage-config") + File.separator + STORAGE_CONF_FILE;
i... |
public void createAuthor(String email, String dob, String name, String displayName, String bio) throws ParseException
{
if(email == null) throw new IllegalArgumentException("Email must not be null");
Date dateOfBirth;
dateOfBirth = (dob == null || "".equals(dob)) ? null : new SimpleDateFormat("dd-... | public void createAuthor(String email, String dob, String name, String displayName, String bio) throws ParseException
{
if(email == null) throw new IllegalArgumentException("Email must not be null");
Date dateOfBirth;
dateOfBirth = (dob == null || "".equals(dob)) ? null : new SimpleDateFormat("yyy... |
private void extract(Query query, Map terms) throws IOException {
if (query instanceof BooleanQuery) {
BooleanClause[] queryClauses = ((BooleanQuery) query).getClauses();
Map booleanTerms = new PositionCheckingMap();
for (int i = 0; i < queryClauses.length; i++) {
if (!queryClauses[i].is... | private void extract(Query query, Map terms) throws IOException {
if (query instanceof BooleanQuery) {
BooleanClause[] queryClauses = ((BooleanQuery) query).getClauses();
Map booleanTerms = new PositionCheckingMap();
for (int i = 0; i < queryClauses.length; i++) {
if (!queryClauses[i].is... |
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
// Unwrap calls for equals
if (method.getName().equals("equals")
&& method.getDeclaringClass() == Object.class) {
Object targetObject = args[0];
if (proxyManager.isProxy(targetObject)) {
... | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
// Unwrap calls for equals
if (method.getName().equals("equals")
&& method.getDeclaringClass() == Object.class) {
Object targetObject = args[0];
if (proxyManager.isProxy(targetObject)) {
... |
public void testStopWordSearching() throws Exception {
Analyzer analyzer = new StandardAnalyzer();
Directory ramDir = new RAMDirectory();
IndexWriter iw = new IndexWriter(ramDir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("body", "blah th... | public void testStopWordSearching() throws Exception {
Analyzer analyzer = new StandardAnalyzer();
Directory ramDir = new RAMDirectory();
IndexWriter iw = new IndexWriter(ramDir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("body", "blah th... |
public boolean incrementToken() throws IOException {
if (index == tokens.length) {
return false;
} else {
termAtt.setTermBuffer(tokens[index++]);
offsetAtt.setOffset(0,0);
return true;
}
}
};
stream = new CachingToke... | public boolean incrementToken() throws IOException {
if (index == tokens.length) {
return false;
} else {
termAtt.setTermBuffer(tokens[index++]);
offsetAtt.setOffset(0,0);
return true;
}
}
};
stream = new CachingToke... |
private void doTestSearch(PrintWriter out, boolean useCompoundFile)
throws Exception
{
Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
IndexWriter writer = new IndexWriter(directory, analyzer, true,
IndexWriter... | private void doTestSearch(PrintWriter out, boolean useCompoundFile)
throws Exception
{
Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
IndexWriter writer = new IndexWriter(directory, analyzer, true,
IndexWriter... |
public boolean incrementToken() {
if (i == TOKENS.length)
return false;
termAtt.setTermBuffer(TOKENS[i]);
offsetAtt.setOffset(i,i);
posIncrAtt.setPositionIncrement(INCREMENTS[i]);
i++;
return true;
}
};
... | public boolean incrementToken() {
if (i == TOKENS.length)
return false;
termAtt.setTermBuffer(TOKENS[i]);
offsetAtt.setOffset(i,i);
posIncrAtt.setPositionIncrement(INCREMENTS[i]);
i++;
return true;
}
};
... |
public void setUp() throws Exception {
super.setUp();
String[] data = new String [] {
"A 1 2 3 4 5 6",
"Z 4 5 6",
null,
"B 2 4 5 6",
"Y 3 5 6",
null,
"C 3 6",
"X 4 5 6"
... | public void setUp() throws Exception {
super.setUp();
String[] data = new String [] {
"A 1 2 3 4 5 6",
"Z 4 5 6",
null,
"B 2 4 5 6",
"Y 3 5 6",
null,
"C 3 6",
"X 4 5 6"
... |
private float checkPhraseQuery(Document doc, PhraseQuery query, int slop, int expectedNumResults) throws Exception {
query.setSlop(slop);
RAMDirectory ramDir = new RAMDirectory();
WhitespaceAnalyzer analyzer = new WhitespaceAnalyzer();
IndexWriter writer = new IndexWriter(ramDir, analyzer, MaxFieldL... | private float checkPhraseQuery(Document doc, PhraseQuery query, int slop, int expectedNumResults) throws Exception {
query.setSlop(slop);
RAMDirectory ramDir = new RAMDirectory();
WhitespaceAnalyzer analyzer = new WhitespaceAnalyzer();
IndexWriter writer = new IndexWriter(ramDir, analyzer, MaxFieldL... |
protected void setUp() throws Exception {
super.setUp();
super.setUp();
//
RAMDirectory rd = new RAMDirectory();
//
IndexWriter writer = new IndexWriter(rd, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
//
Document d = new Document();
d.add(new Field(
FIELD_T,
"Optimiz... | protected void setUp() throws Exception {
super.setUp();
super.setUp();
//
RAMDirectory rd = new RAMDirectory();
//
IndexWriter writer = new IndexWriter(rd, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
//
Document d = new Document();
d.add(new Field(
FIELD_T,
"Optimiz... |
private TopDocsCollector doSearch(int numResults) throws IOException {
Query q = new MatchAllDocsQuery();
IndexSearcher searcher = new IndexSearcher(dir);
TopDocsCollector tdc = new MyTopsDocCollector(numResults);
| private TopDocsCollector doSearch(int numResults) throws IOException {
Query q = new MatchAllDocsQuery();
IndexSearcher searcher = new IndexSearcher(dir, true);
TopDocsCollector tdc = new MyTopsDocCollector(numResults);
|
public void testMethod() throws Exception {
RAMDirectory directory = new RAMDirectory();
String[] categories = new String[]{"food",
"foodanddrink",
"foodanddrinkandgoodtimes",
"food and drink"... | public void testMethod() throws Exception {
RAMDirectory directory = new RAMDirectory();
String[] categories = new String[]{"food",
"foodanddrink",
"foodanddrinkandgoodtimes",
"food and drink"... |
public void setUp() throws Exception {
super.setUp();
index = new RAMDirectory();
IndexWriter writer = new IndexWriter(index,
new WhitespaceAnalyzer(),
true, IndexWriter.MaxFieldLength.LIMITED);
... | public void setUp() throws Exception {
super.setUp();
index = new RAMDirectory();
IndexWriter writer = new IndexWriter(index,
new WhitespaceAnalyzer(),
true, IndexWriter.MaxFieldLength.LIMITED);
... |
public void testMethod() {
RAMDirectory directory = new RAMDirectory();
String[] values = new String[] { "1", "2", "3", "4" };
try {
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < values.length; i++) {
... | public void testMethod() {
RAMDirectory directory = new RAMDirectory();
String[] values = new String[] { "1", "2", "3", "4" };
try {
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < values.length; i++) {
... |
public void testFilterWorks() throws Exception {
Directory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < 500; i++) {
Document document = new Document()... | public void testFilterWorks() throws Exception {
Directory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < 500; i++) {
Document document = new Document()... |
public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < docFields.length; i++) {
Document doc = new Document();
... | public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < docFields.length; i++) {
Document doc = new Document();
... |
public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < docFields.length; i++) {
... | public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < docFields.length; i++) {
... |
public void testPrefixQuery() throws Exception {
RAMDirectory directory = new RAMDirectory();
String[] categories = new String[] {"/Computers",
"/Computers/Mac",
"/Computers/Windows"};
IndexWriter writer = new IndexWriter(dir... | public void testPrefixQuery() throws Exception {
RAMDirectory directory = new RAMDirectory();
String[] categories = new String[] {"/Computers",
"/Computers/Mac",
"/Computers/Windows"};
IndexWriter writer = new IndexWriter(dir... |
public void testOutOfOrderCollection() throws Exception {
Directory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, null, MaxFieldLength.UNLIMITED);
for (int i = 0; i < 10; i++) {
writer.addDocument(new Document());
}
writer.commit();
writer.close();
boolean... | public void testOutOfOrderCollection() throws Exception {
Directory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, null, MaxFieldLength.UNLIMITED);
for (int i = 0; i < 10; i++) {
writer.addDocument(new Document());
}
writer.commit();
writer.close();
boolean... |
public void testNot() throws Exception {
RAMDirectory store = new RAMDirectory();
IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Document d1 = new Document();
d1.add(new Field("field", "a b", Field.Store.YES, Field.Index.ANALYZED));
w... | public void testNot() throws Exception {
RAMDirectory store = new RAMDirectory();
IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Document d1 = new Document();
d1.add(new Field("field", "a b", Field.Store.YES, Field.Index.ANALYZED));
w... |
public void testQuery() throws Exception {
RAMDirectory dir = new RAMDirectory();
IndexWriter iw = new IndexWriter(dir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
iw.setMaxBufferedDocs(2); // force multi-segment
addDoc("one", iw, 1f);
addDoc("two", iw, 20f);
addDoc("three four", iw... | public void testQuery() throws Exception {
RAMDirectory dir = new RAMDirectory();
IndexWriter iw = new IndexWriter(dir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
iw.setMaxBufferedDocs(2); // force multi-segment
addDoc("one", iw, 1f);
addDoc("two", iw, 20f);
addDoc("three four", iw... |
protected void setUp() throws Exception {
super.setUp();
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < values.length; i++)
{
Document doc =... | protected void setUp() throws Exception {
super.setUp();
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < values.length; i++)
{
Document doc =... |
public IndexSearcher setUp(Similarity similarity, int numDocs) throws IOException {
RAMDirectory directory = new RAMDirectory();
PayloadAnalyzer analyzer = new PayloadAnalyzer();
IndexWriter writer
= new IndexWriter(directory, analyzer, true);
writer.setSimilarity(similarity);
//writer... | public IndexSearcher setUp(Similarity similarity, int numDocs) throws IOException {
RAMDirectory directory = new RAMDirectory();
PayloadAnalyzer analyzer = new PayloadAnalyzer();
IndexWriter writer
= new IndexWriter(directory, analyzer, true);
writer.setSimilarity(similarity);
//writer... |
public void testPrefixFilter() throws Exception {
RAMDirectory directory = new RAMDirectory();
String[] categories = new String[] {"/Computers/Linux",
"/Computers/Mac/One",
"/Computers/Mac/Two",
... | public void testPrefixFilter() throws Exception {
RAMDirectory directory = new RAMDirectory();
String[] categories = new String[] {"/Computers/Linux",
"/Computers/Mac/One",
"/Computers/Mac/Two",
... |
public void testLazyLoadThreadSafety() throws Exception{
r = newRandom();
dir1 = new RAMDirectory();
// test w/ field sizes bigger than the buffer of an index input
buildDir(dir1, 15, 5, 2000);
// do many small tests so the thread locals go away inbetween
for (int i=0; i<100; i++) {
ir1... | public void testLazyLoadThreadSafety() throws Exception{
r = newRandom();
dir1 = new RAMDirectory();
// test w/ field sizes bigger than the buffer of an index input
buildDir(dir1, 15, 5, 2000);
// do many small tests so the thread locals go away inbetween
for (int i=0; i<100; i++) {
ir1... |
protected void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
long theLong = Long.MAX_VALUE;
double theDouble = Double.MAX_VALUE;
byte the... | protected void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
long theLong = Long.MAX_VALUE;
double theDouble = Double.MAX_VALUE;
byte the... |
public void test() throws Exception {
IndexReader reader = null;
try {
reader = IndexReader.open(directory);
for(int i = 1; i <= numThreads; i++)
testTermPositionVectors(reader, i);
}
catch (IOException ioe) {
fail(ioe.getMessage());
}
finally ... | public void test() throws Exception {
IndexReader reader = null;
try {
reader = IndexReader.open(directory, true);
for(int i = 1; i <= numThreads; i++)
testTermPositionVectors(reader, i);
}
catch (IOException ioe) {
fail(ioe.getMessage());
}
fi... |
public void testFilteredSearch() {
RAMDirectory directory = new RAMDirectory();
int[] filterBits = {1, 36};
Filter filter = new SimpleDocIdSetFilter(filterBits);
try {
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
... | public void testFilteredSearch() {
RAMDirectory directory = new RAMDirectory();
int[] filterBits = {1, 36};
Filter filter = new SimpleDocIdSetFilter(filterBits);
try {
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
... |
public void testReverseDateSort() throws Exception {
IndexSearcher searcher = new IndexSearcher(directory);
// Create a Sort object. reverse is set to true.
// problem occurs only with SortField.AUTO:
Sort sort = new Sort(new SortField(DATE_TIME_FIELD, SortField.AUTO, true));
QueryParser queryP... | public void testReverseDateSort() throws Exception {
IndexSearcher searcher = new IndexSearcher(directory, true);
// Create a Sort object. reverse is set to true.
// problem occurs only with SortField.AUTO:
Sort sort = new Sort(new SortField(DATE_TIME_FIELD, SortField.AUTO, true));
QueryParser ... |
public void testMissingTerms() throws Exception {
String fieldName = "field1";
MockRAMDirectory rd = new MockRAMDirectory();
IndexWriter w = new IndexWriter(rd, new KeywordAnalyzer(), MaxFieldLength.UNLIMITED);
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int term = i * 1... | public void testMissingTerms() throws Exception {
String fieldName = "field1";
MockRAMDirectory rd = new MockRAMDirectory();
IndexWriter w = new IndexWriter(rd, new KeywordAnalyzer(), MaxFieldLength.UNLIMITED);
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int term = i * 1... |
protected void setUp() throws Exception {
super.setUp();
final String docText[] = {
"docThatNeverMatchesSoWeCanRequireLastDocCollectedToBeGreaterThanZero",
"one blah three",
"one foo three multiOne",
"one foobar three multiThree",
"blueberry pancakes",
"blueberr... | protected void setUp() throws Exception {
super.setUp();
final String docText[] = {
"docThatNeverMatchesSoWeCanRequireLastDocCollectedToBeGreaterThanZero",
"one blah three",
"one foo three multiOne",
"one foobar three multiThree",
"blueberry pancakes",
"blueberr... |
public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
//writer.infoStream = System.out;
for (int i... | public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
//writer.infoStream = System.out;
for (int i... |
public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory,
new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
wr... | public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory,
new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
wr... |
protected void setUp() throws Exception {
super.setUp();
super.setUp();
// create test index
mDirectory = new RAMDirectory();
final IndexWriter writer = new IndexWriter(mDirectory, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
addDocument(writer,... | protected void setUp() throws Exception {
super.setUp();
super.setUp();
// create test index
mDirectory = new RAMDirectory();
final IndexWriter writer = new IndexWriter(mDirectory, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
addDocument(writer,... |
public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < docFields.length; i++) {
Document doc = new Document();
... | public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < docFields.length; i++) {
Document doc = new Document();
... |
private void doTestCustomScore (String field, FieldScoreQuery.Type tp, double dboost) throws CorruptIndexException, Exception {
float boost = (float) dboost;
IndexSearcher s = new IndexSearcher(dir);
FieldScoreQuery qValSrc = new FieldScoreQuery(field,tp); // a query that would score by the field
Quer... | private void doTestCustomScore (String field, FieldScoreQuery.Type tp, double dboost) throws CorruptIndexException, Exception {
float boost = (float) dboost;
IndexSearcher s = new IndexSearcher(dir, true);
FieldScoreQuery qValSrc = new FieldScoreQuery(field,tp); // a query that would score by the field
... |
private void verifyDocFreq()
throws IOException
{
IndexReader reader = IndexReader.open(dir);
TermEnum termEnum = null;
// create enumeration of all terms
termEnum = reader.terms();
// go to the first term (aaa)
termEnum.next();
// assert that term is 'aaa'
assertEquals("a... | private void verifyDocFreq()
throws IOException
{
IndexReader reader = IndexReader.open(dir, true);
TermEnum termEnum = null;
// create enumeration of all terms
termEnum = reader.terms();
// go to the first term (aaa)
termEnum.next();
// assert that term is 'aaa'
assertEqu... |
public void testExceptions() throws Throwable {
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir == null)
throw new IOException("java.io.tmpdir undefined, cannot run test");
File indexDir = new File(tempDir, "testfieldswriterexceptions");
try {
Directory dir = new Faulty... | public void testExceptions() throws Throwable {
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir == null)
throw new IOException("java.io.tmpdir undefined, cannot run test");
File indexDir = new File(tempDir, "testfieldswriterexceptions");
try {
Directory dir = new Faulty... |
public void testMapper() throws IOException {
TermVectorsReader reader = new TermVectorsReader(dir, seg, fieldInfos);
assertTrue(reader != null);
SortedTermVectorMapper mapper = new SortedTermVectorMapper(new TermVectorEntryFreqSortedComparator());
reader.get(0, mapper);
SortedSet set = mapper.get... | public void testMapper() throws IOException {
TermVectorsReader reader = new TermVectorsReader(dir, seg, fieldInfos);
assertTrue(reader != null);
SortedTermVectorMapper mapper = new SortedTermVectorMapper(new TermVectorEntryFreqSortedComparator());
reader.get(0, mapper);
SortedSet set = mapper.get... |
public void doWork() throws Throwable {
for (int i=0; i<100; i++)
(new IndexSearcher(directory)).close();
count += 100;
}
}
| public void doWork() throws Throwable {
for (int i=0; i<100; i++)
(new IndexSearcher(directory, true)).close();
count += 100;
}
}
|
private boolean verifyIndex(Directory directory, int startAt) throws IOException
{
boolean fail = false;
IndexReader reader = IndexReader.open(directory);
int max = reader.maxDoc();
for (int i = 0; i < max; i++)
{
Document temp = reader.document(i);
//System.out.println("doc "+i+"="... | private boolean verifyIndex(Directory directory, int startAt) throws IOException
{
boolean fail = false;
IndexReader reader = IndexReader.open(directory, true);
int max = reader.maxDoc();
for (int i = 0; i < max; i++)
{
Document temp = reader.document(i);
//System.out.println("doc "... |
public void testSeek() throws IOException {
Directory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < 10; i++) {
Document doc = new Document();
doc... | public void testSeek() throws IOException {
Directory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < 10; i++) {
Document doc = new Document();
doc... |
public void testFilterIndexReader() throws Exception {
RAMDirectory directory = new MockRAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
Document d1 = new Document();
d1.add(ne... | public void testFilterIndexReader() throws Exception {
RAMDirectory directory = new MockRAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
Document d1 = new Document();
d1.add(ne... |
public void testDeletedDocs() throws IOException {
MockRAMDirectory dir = new MockRAMDirectory();
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
writer.setMaxBufferedDocs(2);
Document doc ... | public void testDeletedDocs() throws IOException {
MockRAMDirectory dir = new MockRAMDirectory();
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true,
IndexWriter.MaxFieldLength.LIMITED);
writer.setMaxBufferedDocs(2);
Document doc ... |
public int doTest(int iter, int ndocs, int maxTF, float percentDocs) throws IOException {
Directory dir = new RAMDirectory();
long start = System.currentTimeMillis();
addDocs(dir, ndocs, "foo", "val", maxTF, percentDocs);
long end = System.currentTimeMillis();
System.out.println("milliseconds for... | public int doTest(int iter, int ndocs, int maxTF, float percentDocs) throws IOException {
Directory dir = new RAMDirectory();
long start = System.currentTimeMillis();
addDocs(dir, ndocs, "foo", "val", maxTF, percentDocs);
long end = System.currentTimeMillis();
System.out.println("milliseconds for... |
public void testMixedTermVectorSettingsSameField() throws Exception {
Document doc = new Document();
// f1 first without tv then with tv
doc.add(new Field("f1", "v1", Store.YES, Index.NOT_ANALYZED, TermVector.NO));
doc.add(new Field("f1", "v2", Store.YES, Index.NOT_ANALYZED, TermVector.WITH_POSITIONS_... | public void testMixedTermVectorSettingsSameField() throws Exception {
Document doc = new Document();
// f1 first without tv then with tv
doc.add(new Field("f1", "v1", Store.YES, Index.NOT_ANALYZED, TermVector.NO));
doc.add(new Field("f1", "v2", Store.YES, Index.NOT_ANALYZED, TermVector.WITH_POSITIONS_... |
public void testDeleteLeftoverFiles() throws IOException {
Directory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
writer.setMaxBufferedDocs(10);
int i;
for(i=0;i<35;i++) {
addDoc(writer, i);
}
... | public void testDeleteLeftoverFiles() throws IOException {
Directory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
writer.setMaxBufferedDocs(10);
int i;
for(i=0;i<35;i++) {
addDoc(writer, i);
}
... |
public void doTest(int[] docs) throws Exception {
Directory dir = makeIndex();
IndexReader reader = IndexReader.open(dir);
for (int i = 0; i < docs.length; i++) {
Document d = reader.document(docs[i], SELECTOR);
d.get(MAGIC_FIELD);
List fields = d.getFields();
for (Iterator ... | public void doTest(int[] docs) throws Exception {
Directory dir = makeIndex();
IndexReader reader = IndexReader.open(dir, true);
for (int i = 0; i < docs.length; i++) {
Document d = reader.document(docs[i], SELECTOR);
d.get(MAGIC_FIELD);
List fields = d.getFields();
for (Ite... |
public void run() {
try {
for(int j=0;j<NUM_ITER2;j++) {
writerFinal.optimize(false);
for(int k=0;k<17*(1+iFinal);k++) {
Document d = new Document();
d.add(new Field("id", iterFinal + "_" + iFinal + "_" + j + "_" + k... | public void run() {
try {
for(int j=0;j<NUM_ITER2;j++) {
writerFinal.optimize(false);
for(int k=0;k<17*(1+iFinal);k++) {
Document d = new Document();
d.add(new Field("id", iterFinal + "_" + iFinal + "_" + j + "_" + k... |
public void testBasic() throws Exception {
Directory dir = new MockRAMDirectory();
Analyzer analyzer = new StandardAnalyzer();
IndexWriter writer = new IndexWriter(dir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
writer.setMergeFactor(2);
writer.setMaxBufferedDocs(2);
writer.setSimi... | public void testBasic() throws Exception {
Directory dir = new MockRAMDirectory();
Analyzer analyzer = new StandardAnalyzer();
IndexWriter writer = new IndexWriter(dir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
writer.setMergeFactor(2);
writer.setMaxBufferedDocs(2);
writer.setSimi... |
public void testMergeDocCount0() throws IOException {
Directory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, true, new WhitespaceAnalyzer(), true);
writer.setMergePolicy(new LogDocMergePolicy(writer));
writer.setMaxBufferedDocs(10);
writer.setMergeFactor(100);
for (int... | public void testMergeDocCount0() throws IOException {
Directory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, true, new WhitespaceAnalyzer(), true);
writer.setMergePolicy(new LogDocMergePolicy(writer));
writer.setMaxBufferedDocs(10);
writer.setMergeFactor(100);
for (int... |
public void testSetBufferSize() throws IOException {
File indexDir = new File(System.getProperty("tempDir"), "testSetBufferSize");
MockFSDirectory dir = new MockFSDirectory(indexDir, newRandom());
try {
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.M... | public void testSetBufferSize() throws IOException {
File indexDir = new File(System.getProperty("tempDir"), "testSetBufferSize");
MockFSDirectory dir = new MockFSDirectory(indexDir, newRandom());
try {
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.M... |
public void testMmapIndex() throws Exception {
FSDirectory storeDirectory;
storeDirectory = new MMapDirectory(new File(storePathname), null);
// plan to add a set of useful stopwords, consider changing some of the
// interior filters.
StandardAnalyzer analyzer = new StandardAnalyzer(new HashSet());
// TOD... | public void testMmapIndex() throws Exception {
FSDirectory storeDirectory;
storeDirectory = new MMapDirectory(new File(storePathname), null);
// plan to add a set of useful stopwords, consider changing some of the
// interior filters.
StandardAnalyzer analyzer = new StandardAnalyzer(new HashSet());
// TOD... |
protected void init(IndexSchema schema, Map<String, String> args) {
super.init(schema, args);
if (this.isMultiValued()) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"CurrencyField types can not be multiValued: " +
this.typ... | protected void init(IndexSchema schema, Map<String, String> args) {
super.init(schema, args);
if (this.isMultiValued()) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"CurrencyField types can not be multiValued: " +
this.typ... |
public final TextFragment[] getBestTextFragments(
TokenStream tokenStream,
String text,
boolean mergeContiguousFragments,
int maxNumFragments)
throws IOException
{
ArrayList docFrags = new ArrayList();
StringBuffer newText=new StringBuffer();
TextFragment currentFrag = new TextFragment(newText,newTex... | public final TextFragment[] getBestTextFragments(
TokenStream tokenStream,
String text,
boolean mergeContiguousFragments,
int maxNumFragments)
throws IOException
{
ArrayList docFrags = new ArrayList();
StringBuffer newText=new StringBuffer();
TextFragment currentFrag = new TextFragment(newText,newTex... |
public void nextTerm(FieldInfo fieldInfo, BlockTermState _termState) throws IOException {
final FixedTermState termState = (FixedTermState) _termState;
final boolean isFirstTerm = termState.termCount == 0;
termState.docIndex.read(termState.bytesReader, isFirstTerm);
if (!fieldInfo.omitTermFreqAndPos... | public void nextTerm(FieldInfo fieldInfo, BlockTermState _termState) throws IOException {
final FixedTermState termState = (FixedTermState) _termState;
final boolean isFirstTerm = termState.termCount == 0;
termState.docIndex.read(termState.bytesReader, isFirstTerm);
if (!fieldInfo.omitTermFreqAndPos... |
public RowMutation makeReplicationMutation() throws IOException
{
List<ReadCommand> readCommands = new LinkedList<ReadCommand>();
for (ColumnFamily columnFamily : rowMutation.getColumnFamilies())
{
if (!columnFamily.metadata().getReplicateOnWrite())
continue;
... | public RowMutation makeReplicationMutation() throws IOException
{
List<ReadCommand> readCommands = new LinkedList<ReadCommand>();
for (ColumnFamily columnFamily : rowMutation.getColumnFamilies())
{
if (!columnFamily.metadata().getReplicateOnWrite())
continue;
... |
private static void addBundleRequirement(Document doc, Element resource, BundleInfo info, Content p)
{
Element requirement = doc.createElement("require");
requirement.setAttribute("name", "bundle");
requirement.setAttribute("extend", "false");
requirement.setAttribute("multiple", "false");
... | private static void addBundleRequirement(Document doc, Element resource, BundleInfo info, Content p)
{
Element requirement = doc.createElement("require");
requirement.setAttribute("name", "bundle");
requirement.setAttribute("extend", "false");
requirement.setAttribute("multiple", "false");
... |
private void initiateStreaming()
{
ColumnFamilyStore cfstore = Table.open(tableName).getColumnFamilyStore(cfName);
try
{
logger.info(String.format("[streaming task #%s] Performing streaming repair of %d ranges with %s", id, ranges.size(), dst));
// We acquire refe... | private void initiateStreaming()
{
ColumnFamilyStore cfstore = Table.open(tableName).getColumnFamilyStore(cfName);
try
{
logger.info(String.format("[streaming task #%s] Performing streaming repair of %d ranges with %s", id, ranges.size(), dst));
// We acquire refe... |
protected int getTimestampLength()
{
return supportsTimestampNanoseconds() ?
DRDAConstants.JDBC_TIMESTAMP_LENGTH : DRDAConstants.DRDA_TIMESTAMP_LENGTH;
}
| protected int getTimestampLength()
{
return supportsTimestampNanoseconds() ?
DRDAConstants.JDBC_TIMESTAMP_LENGTH : DRDAConstants.DRDA_OLD_TIMESTAMP_LENGTH;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.