buggy_function
stringlengths
1
391k
fixed_function
stringlengths
0
392k
public static int getTimestampLength( boolean supportsTimestampNanoseconds ) { return supportsTimestampNanoseconds ? DRDAConstants.JDBC_TIMESTAMP_LENGTH : DRDAConstants.DRDA_TIMESTAMP_LENGTH; }
public static int getTimestampLength( boolean supportsTimestampNanoseconds ) { return supportsTimestampNanoseconds ? DRDAConstants.JDBC_TIMESTAMP_LENGTH : DRDAConstants.DRDA_OLD_TIMESTAMP_LENGTH; }
public void testCorruptionAfterDiskFullDuringMerge() throws IOException { MockDirectoryWrapper dir = newDirectory(); //IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setReaderPooling(true)); IndexWriter w = new IndexWriter( dir, ne...
public void testCorruptionAfterDiskFullDuringMerge() throws IOException { MockDirectoryWrapper dir = newDirectory(); //IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setReaderPooling(true)); IndexWriter w = new IndexWriter( dir, ne...
public String toString() { final StringBuilder buffer = new StringBuilder(); if (hasChanges) { buffer.append("*"); } buffer.append(getClass().getSimpleName()); buffer.append('('); final String segmentsFile = segmentInfos.getCurrentSegmentFileName(); if (segmentsFile != null) { ...
public String toString() { final StringBuilder buffer = new StringBuilder(); if (hasChanges) { buffer.append("*"); } buffer.append(getClass().getSimpleName()); buffer.append('('); final String segmentsFile = segmentInfos.getCurrentSegmentFileName(); if (segmentsFile != null) { ...
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 void checkpoint(SegmentInfos segmentInfos, boolean isCommit) throws IOException { if (infoStream != null) { message("now checkpoint \"" + segmentInfos + "\" [" + segmentInfos.size() + " segments " + "; isCommit = " + isCommit + "]"); } // Try again now to delete any previously un-deletable ...
public void checkpoint(SegmentInfos segmentInfos, boolean isCommit) throws IOException { if (infoStream != null) { message("now checkpoint \"" + segmentInfos.toString(directory) + "\" [" + segmentInfos.size() + " segments " + "; isCommit = " + isCommit + "]"); } // Try again now to delete any prev...
private void extractGroupedInfo( NamedList<Object> info ) { if ( info != null ) { _groupResponse = new GroupResponse(); int size = info.size(); for (int i=0; i < size; i++) { String fieldName = info.getName(i); Object fieldGroups = info.getVal(i); SimpleOrderedMap<Object...
private void extractGroupedInfo( NamedList<Object> info ) { if ( info != null ) { _groupResponse = new GroupResponse(); int size = info.size(); for (int i=0; i < size; i++) { String fieldName = info.getName(i); Object fieldGroups = info.getVal(i); SimpleOrderedMap<Object...
private void runSuperCounterGetter(SlicePredicate predicate, Cassandra.Client client) throws IOException { byte[] rawKey = generateKey(); ByteBuffer key = ByteBuffer.wrap(rawKey); for (int j = 0; j < session.getSuperColumns(); j++) { String superColumn = 'S' + Intege...
private void runSuperCounterGetter(SlicePredicate predicate, Cassandra.Client client) throws IOException { byte[] rawKey = generateKey(); ByteBuffer key = ByteBuffer.wrap(rawKey); for (int j = 0; j < session.getSuperColumns(); j++) { String superColumn = 'S' + Intege...
public void testLotsOfPhrases() throws IOException { Directory dir = newDirectory(); IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET))); FieldType type = new FieldType(TextField.TYP...
public void testLotsOfPhrases() throws IOException { Directory dir = newDirectory(); IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET))); FieldType type = new FieldType(TextField.TYP...
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 (ch...
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 (ch...
private int getConstantLength( ) throws StandardException { DataTypeDescriptor typeDescriptor = operand.getTypeServices(); switch( typeDescriptor.getJDBCTypeId()) { case Types.BIGINT: return 8; case org.apache.derby.iapi.reference.JDBC30Translation.SQL_TYPE...
private int getConstantLength( ) throws StandardException { DataTypeDescriptor typeDescriptor = operand.getTypeServices(); switch( typeDescriptor.getJDBCTypeId()) { case Types.BIGINT: return 8; case Types.BOOLEAN: case Types.BIT: return ...
public void createListFromResultSetMetaData(ResultSetMetaData rsmd, TableName tableName, String javaClassName) throws StandardException { try { // JDBC columns #s are 1-based // Check to make sure # of columns >= 1 int numColumns = rsmd.getColumnCount(); if (numColumns <= 0...
public void createListFromResultSetMetaData(ResultSetMetaData rsmd, TableName tableName, String javaClassName) throws StandardException { try { // JDBC columns #s are 1-based // Check to make sure # of columns >= 1 int numColumns = rsmd.getColumnCount(); if (numColumns <= 0...
public void updateObject(int columnIndex, Object x) throws SQLException { checksBeforeUpdateXXX("updateObject", columnIndex); int colType = getColumnType(columnIndex); if (colType == org.apache.derby.iapi.reference.JDBC20Translation.SQL_TYPES_JAVA_OBJECT) { try { ((UserDataValue) getDVDforColumnToBeUpdate...
public void updateObject(int columnIndex, Object x) throws SQLException { checksBeforeUpdateXXX("updateObject", columnIndex); int colType = getColumnType(columnIndex); if (colType == Types.JAVA_OBJECT) { try { ((UserDataValue) getDVDforColumnToBeUpdated(columnIndex, "updateObject")).setValue(x); retur...
public static boolean isNumericType(int jdbcType) { switch (jdbcType) { case Types.BIT: case org.apache.derby.iapi.reference.JDBC30Translation.SQL_TYPES_BOOLEAN: case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: case Types.REAL: case Types.FLOAT: case Types.DOUBLE: ...
public static boolean isNumericType(int jdbcType) { switch (jdbcType) { case Types.BIT: case Types.BOOLEAN: case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: case Types.REAL: case Types.FLOAT: case Types.DOUBLE: case Types.DECIMAL: case Types.NUMERIC: return tr...
private void readAndSetParams(int i, DRDAStatement stmt, ParameterMetaData pmeta) throws DRDAProtocolException, SQLException { PreparedStatement ps = stmt.getPreparedStatement(); // mask out null indicator final int drdaType = ((stmt.getParamDRDAType(i+1) | 0x01) & 0xff); final int pa...
private void readAndSetParams(int i, DRDAStatement stmt, ParameterMetaData pmeta) throws DRDAProtocolException, SQLException { PreparedStatement ps = stmt.getPreparedStatement(); // mask out null indicator final int drdaType = ((stmt.getParamDRDAType(i+1) | 0x01) & 0xff); final int pa...
public String getSummary() throws IOException, InterruptedException { if (pipeIn == null) getReader(); // spawn parsing thread while (true) { synchronized(this) { if (summary.length() >= SUMMARY_LENGTH || pipeInStream.full()) break; wait(10)...
public String getSummary() throws IOException, InterruptedException { if (pipeIn == null) getReader(); // spawn parsing thread while (true) { synchronized(this) { if (summary.length() >= SUMMARY_LENGTH || pipeInStream.full()) break; wait(10)...
public int read(byte[] buf, int off, int length) { if (remainingBlanks <= 0 && remainingNonBlanks <= 0) { return -1; } // We can only read as many bytes as there are in the stream. int nonBlankLength = Math.min((int)remainingNonBlanks, length); fillBuffer(nonBlank...
public int read(byte[] buf, int off, int length) { if (remainingBlanks <= 0 && remainingNonBlanks <= 0) { return -1; } // We can only read as many bytes as there are in the stream. int nonBlankLength = (int)Math.min(remainingNonBlanks, (long)length); fillBuffer(no...
public void testDemo() throws IOException, ParseException { Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT); // Store the index in memory: Directory directory = new RAMDirectory(); // To store an index on disk, use this instead: //Directory directory = FSDirectory.open("/tmp/tes...
public void testDemo() throws IOException, ParseException { Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT); // Store the index in memory: Directory directory = new RAMDirectory(); // To store an index on disk, use this instead: //Directory directory = FSDirectory.open("/tmp/tes...
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...
public static void main(String[] args) throws Exception { String usage = "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-norms field] [-paging hitsPerPage]"; usage += "\n\tSpecify 'false' for hitsPerPage to use streaming instead of paging sea...
public static void main(String[] args) throws Exception { String usage = "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-norms field] [-paging hitsPerPage]"; usage += "\n\tSpecify 'false' for hitsPerPage to use streaming instead of paging sea...
public Query parse(QualityQuery qq) throws ParseException { QueryParser qp = queryParser.get(); if (qp==null) { qp = new QueryParser(indexField, new StandardAnalyzer(Version.LUCENE_CURRENT)); queryParser.set(qp); } return qp.parse(qq.getValue(qqName)); }
public Query parse(QualityQuery qq) throws ParseException { QueryParser qp = queryParser.get(); if (qp==null) { qp = new QueryParser(Version.LUCENE_CURRENT, indexField, new StandardAnalyzer(Version.LUCENE_CURRENT)); queryParser.set(qp); } return qp.parse(qq.getValue(qqName)); }
public FastIDSet getItemIDsFromUser(long id) throws TasteException { log.debug("Retrieving items for user ID '{}'", id); Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { conn = dataSource.getConnection(); stmt = conn.prepareStatement(getUserSQL, Resu...
public FastIDSet getItemIDsFromUser(long id) throws TasteException { log.debug("Retrieving items for user ID '{}'", id); Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { conn = dataSource.getConnection(); stmt = conn.prepareStatement(getUserSQL, Resu...
public Object toObject(IndexableField f) { if (f.numeric()) { final Number val = f.numericValue(); if (val==null) return badFieldString(f); return (type == TrieTypes.DATE) ? new Date(val.longValue()) : val; } else { // the following code is "deprecated" and only to support pre-3.2 inde...
public Object toObject(IndexableField f) { if (f.numericDataType() != null) { final Number val = f.numericValue(); if (val==null) return badFieldString(f); return (type == TrieTypes.DATE) ? new Date(val.longValue()) : val; } else { // the following code is "deprecated" and only to supp...
public Column deserialize(DataInput dis) throws IOException { ByteBuffer name = FBUtilities.readShortByteArray(dis); if (name.remaining() <= 0) throw new CorruptColumnException("invalid column name length " + name.remaining()); int b = dis.readUnsignedByte(); if ((b ...
public Column deserialize(DataInput dis) throws IOException { ByteBuffer name = FBUtilities.readShortByteArray(dis); if (name.remaining() <= 0) throw new CorruptColumnException("invalid column name length " + name.remaining()); int b = dis.readUnsignedByte(); if ((b ...
public void boot(boolean create, Properties startParams) throws StandardException { softwareVersion = new DD_Version(this, DataDictionary.DD_VERSION_DERBY_10_5); startupParameters = startParams; uuidFactory = Monitor.getMonitor().getUUIDFactory(); engineType = Monitor.getEngineType( startParams ); /...
public void boot(boolean create, Properties startParams) throws StandardException { softwareVersion = new DD_Version(this, DataDictionary.DD_VERSION_DERBY_10_6); startupParameters = startParams; uuidFactory = Monitor.getMonitor().getUUIDFactory(); engineType = Monitor.getEngineType( startParams ); /...
private static void runFPGrowth(Parameters params) throws IOException { log.info("Starting Sequential FPGrowth"); int maxHeapSize = Integer.valueOf(params.get("maxHeapSize", "50")); int minSupport = Integer.valueOf(params.get("minSupport", "3")); String output = params.get("output", "output.txt"); ...
private static void runFPGrowth(Parameters params) throws IOException { log.info("Starting Sequential FPGrowth"); int maxHeapSize = Integer.valueOf(params.get("maxHeapSize", "50")); int minSupport = Integer.valueOf(params.get("minSupport", "3")); String output = params.get("output", "output.txt"); ...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); iwc.setMergePolicy(newLogMergePolicy()); RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwc); Document d...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); iwc.setMergePolicy(newLogMergePolicy()); RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwc); Document d...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), dir); Document doc = new Document(); doc.add(newStringField("id", "1", Field.Store.YES)); doc.add(newTextField("body", "some contents and more contents", Fiel...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), dir); Document doc = new Document(); doc.add(newStringField("id", "1", Field.Store.YES)); doc.add(newTextField("body", "some contents and more contents", Fiel...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), dir); Document doc = new Document(); doc.add(newStringField("id", "1", Field.Store.YES)); doc.add(newTextField("body", "some contents and more contents", Fiel...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), dir); Document doc = new Document(); doc.add(newStringField("id", "1", Field.Store.YES)); doc.add(newTextField("body", "some contents and more contents", Fiel...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), dir); int numDocs = TestUtil.nextInt(random(), 2049, 4000); for (int i = 0; i < numDocs; i++) { Document document = new Document(); document.add(newTextFie...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), dir); int numDocs = TestUtil.nextInt(random(), 2049, 4000); for (int i = 0; i < numDocs; i++) { Document document = new Document(); document.add(newTextFie...
public static void beforeClassDrillDownQueryTest() throws Exception { dir = newDirectory(); Random r = random(); RandomIndexWriter writer = new RandomIndexWriter(r, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(r, MockTokenizer.KEYWORD, false))); taxoDir = newDirectory...
public static void beforeClassDrillDownQueryTest() throws Exception { dir = newDirectory(); Random r = random(); RandomIndexWriter writer = new RandomIndexWriter(r, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(r, MockTokenizer.KEYWORD, false))); taxoDir = newDirectory...
public void setUp() throws Exception { super.setUp(); analyzer = new MockAnalyzer(random()); rd = newDirectory(); IndexWriter w = new IndexWriter(rd, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); for (int i = 0; i < docsContent.length; i++) { Document doc = new Document(); ...
public void setUp() throws Exception { super.setUp(); analyzer = new MockAnalyzer(random()); rd = newDirectory(); IndexWriter w = new IndexWriter(rd, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); for (int i = 0; i < docsContent.length; i++) { Document doc = new Document(); ...
public void testStopWordSearching() throws Exception { Analyzer analyzer = new MockAnalyzer(random()); Directory ramDir = newDirectory(); IndexWriter iw = new IndexWriter(ramDir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); Document doc = new Document(); doc.add(newTextField("body", "bla...
public void testStopWordSearching() throws Exception { Analyzer analyzer = new MockAnalyzer(random()); Directory ramDir = newDirectory(); IndexWriter iw = new IndexWriter(ramDir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); Document doc = new Document(); doc.add(newTextField("body", "bla...
public void testMultiPhraseQuery() throws Exception { Directory dir = newDirectory(); IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new CannedAnalyzer())); Document doc = new Document(); doc.add(newTextField("field", "", Field.Store.NO)); w.addDocument(doc); I...
public void testMultiPhraseQuery() throws Exception { Directory dir = newDirectory(); IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new CannedAnalyzer())); Document doc = new Document(); doc.add(newTextField("field", "", Field.Store.NO)); w.addDocument(doc); I...
public static void beforeClass() throws Exception { ANALYZER = new MockAnalyzer(random()); qp = new StandardQueryParser(ANALYZER); final HashMap<String,Number> randomNumberMap = new HashMap<>(); SimpleDateFormat dateFormat; long randomDate; boolean dateFormatSanityCheckPass; ...
public static void beforeClass() throws Exception { ANALYZER = new MockAnalyzer(random()); qp = new StandardQueryParser(ANALYZER); final HashMap<String,Number> randomNumberMap = new HashMap<>(); SimpleDateFormat dateFormat; long randomDate; boolean dateFormatSanityCheckPass; ...
private boolean isAHit(Query q, String content, Analyzer analyzer) throws IOException{ Directory ramDir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), ramDir, analyzer); Document doc = new Document(); FieldType fieldType = new FieldType(); fieldType.setIndexed(true); ...
private boolean isAHit(Query q, String content, Analyzer analyzer) throws IOException{ Directory ramDir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), ramDir, analyzer); Document doc = new Document(); FieldType fieldType = new FieldType(); fieldType.setIndexed(true); ...
public void testPositionIncrements() throws Exception { Directory dir = newDirectory(); Analyzer a = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET); IndexWriter w = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, a)); Document doc = new Documen...
public void testPositionIncrements() throws Exception { Directory dir = newDirectory(); Analyzer a = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET); IndexWriter w = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, a)); Document doc = new Documen...
public void testGetFilterHandleNumericParseError() throws Exception { NumericRangeFilterBuilder filterBuilder = new NumericRangeFilterBuilder(); filterBuilder.setStrictMode(false); String xml = "<NumericRangeFilter fieldName='AGE' type='int' lowerTerm='-1' upperTerm='NaN'/>"; Document doc = getDocume...
public void testGetFilterHandleNumericParseError() throws Exception { NumericRangeFilterBuilder filterBuilder = new NumericRangeFilterBuilder(); filterBuilder.setStrictMode(false); String xml = "<NumericRangeFilter fieldName='AGE' type='int' lowerTerm='-1' upperTerm='NaN'/>"; Document doc = getDocume...
public static void beforeClass() throws Exception { // TODO: rewrite test (this needs to set QueryParser.enablePositionIncrements, too, for work with CURRENT): Analyzer analyzer = new MockAnalyzer(random(), MockTokenizer.WHITESPACE, true, MockTokenFilter.ENGLISH_STOPSET); //initialize the parser build...
public static void beforeClass() throws Exception { // TODO: rewrite test (this needs to set QueryParser.enablePositionIncrements, too, for work with CURRENT): Analyzer analyzer = new MockAnalyzer(random(), MockTokenizer.WHITESPACE, true, MockTokenFilter.ENGLISH_STOPSET); //initialize the parser build...
public void setUp() throws Exception { super.setUp(); analyzer = new MockAnalyzer(random()); //Create an index dir = newDirectory(); IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); for (String docFieldValue : docFieldValues) { w.addDocument(ge...
public void setUp() throws Exception { super.setUp(); analyzer = new MockAnalyzer(random()); //Create an index dir = newDirectory(); IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); for (String docFieldValue : docFieldValues) { w.addDocument(ge...
public void testStopWordSearching() throws Exception { Analyzer analyzer = new MockAnalyzer(random()); Directory ramDir = newDirectory(); IndexWriter iw = new IndexWriter(ramDir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); Document doc = new Document(); doc.add(newTextField("body", "bl...
public void testStopWordSearching() throws Exception { Analyzer analyzer = new MockAnalyzer(random()); Directory ramDir = newDirectory(); IndexWriter iw = new IndexWriter(ramDir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); Document doc = new Document(); doc.add(newTextField("body", "bl...
public SingleFieldTestDb(Random random, String[] documents, String fName) { try { db = new MockDirectoryWrapper(random, new RAMDirectory()); docs = documents; fieldName = fName; IndexWriter writer = new IndexWriter(db, new IndexWriterConfig( Version.LUCENE_CURRENT, new ...
public SingleFieldTestDb(Random random, String[] documents, String fName) { try { db = new MockDirectoryWrapper(random, new RAMDirectory()); docs = documents; fieldName = fName; IndexWriter writer = new IndexWriter(db, new IndexWriterConfig( Version.LUCENE_CURRENT, new ...
public static void main(String[] args) { String usage = "java org.apache.lucene.demo.IndexFiles" + " [-index INDEX_PATH] [-docs DOCS_PATH] [-update]\n\n" + "This indexes the documents in DOCS_PATH, creating a Lucene index" + "in INDEX_PATH that can be searched wi...
public static void main(String[] args) { String usage = "java org.apache.lucene.demo.IndexFiles" + " [-index INDEX_PATH] [-docs DOCS_PATH] [-update]\n\n" + "This indexes the documents in DOCS_PATH, creating a Lucene index" + "in INDEX_PATH that can be searched wi...
private void openExampleIndex() throws IOException { //Create a RAM-based index from our test data file RAMDirectory rd = new RAMDirectory(); IndexWriterConfig iwConfig = new IndexWriterConfig(Version.LUCENE_CURRENT, analyzer); IndexWriter writer = new IndexWriter(rd, iwConfig); InputStream dataIn...
private void openExampleIndex() throws IOException { //Create a RAM-based index from our test data file RAMDirectory rd = new RAMDirectory(); IndexWriterConfig iwConfig = new IndexWriterConfig(Version.LUCENE_CURRENT, analyzer); IndexWriter writer = new IndexWriter(rd, iwConfig); InputStream dataIn...
private void index() throws IOException { IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); Document doc = new Document(); doc.add(new SortedSetDocValuesFacetField("Author", "Bob")); doc....
private void index() throws IOException { IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); Document doc = new Document(); doc.add(new SortedSetDocValuesFacetField("Author", "Bob")); doc....
private void index() throws IOException { IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); // Writes facet ords to a separate directory from the main index DirectoryTaxonomyWriter taxoWrite...
private void index() throws IOException { IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); // Writes facet ords to a separate directory from the main index DirectoryTaxonomyWriter taxoWrite...
private void index() throws IOException { IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); // Writes facet ords to a separate directory from the main index DirectoryTaxonomyWriter taxoWrite...
private void index() throws IOException { IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); // Writes facet ords to a separate directory from the main index DirectoryTaxonomyWriter taxoWrite...
public void index() throws IOException { IndexWriter writer = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); // TODO: we could index in radians instead ... saves all the conversions in getBoundingBoxFilter // Add...
public void index() throws IOException { IndexWriter writer = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); // TODO: we could index in radians instead ... saves all the conversions in getBoundingBoxFilter // Add...
public void index() throws IOException { IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); // Add documents with a fake timestamp, 1000 sec before // "now", 2000 sec before "now", ...: f...
public void index() throws IOException { IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER))); // Add documents with a fake timestamp, 1000 sec before // "now", 2000 sec before "now", ...: f...
private void index() throws IOException { IndexWriterConfig iwc = new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER)); IndexWriter indexWriter = new IndexWriter(indexDir, iwc); // Writes facet ords to a s...
private void index() throws IOException { IndexWriterConfig iwc = new IndexWriterConfig(FacetExamples.EXAMPLES_VER, new WhitespaceAnalyzer(FacetExamples.EXAMPLES_VER)); IndexWriter indexWriter = new IndexWriter(indexDir, iwc); // Writes facet ords to a s...
public void testBasic() throws IOException { Set<String> fileExtensions = new HashSet<>(); fileExtensions.add(Lucene40StoredFieldsWriter.FIELDS_EXTENSION); fileExtensions.add(Lucene40StoredFieldsWriter.FIELDS_INDEX_EXTENSION); MockDirectoryWrapper primaryDir = new MockDirectoryWrapper(random(), n...
public void testBasic() throws IOException { Set<String> fileExtensions = new HashSet<>(); fileExtensions.add(Lucene40StoredFieldsWriter.FIELDS_EXTENSION); fileExtensions.add(Lucene40StoredFieldsWriter.FIELDS_INDEX_EXTENSION); MockDirectoryWrapper primaryDir = new MockDirectoryWrapper(random(), n...
public void testSetBufferSize() throws IOException { File indexDir = createTempDir("testSetBufferSize"); MockFSDirectory dir = new MockFSDirectory(indexDir, random()); try { IndexWriter writer = new IndexWriter( dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new M...
public void testSetBufferSize() throws IOException { File indexDir = createTempDir("testSetBufferSize"); MockFSDirectory dir = new MockFSDirectory(indexDir, random()); try { IndexWriter writer = new IndexWriter( dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new M...
private void assertChunking(Random random, int chunkSize) throws Exception { File path = createTempDir("mmap" + chunkSize); MMapDirectory mmapDir = new MMapDirectory(path, null, chunkSize); // we will map a lot, try to turn on the unmap hack if (MMapDirectory.UNMAP_SUPPORTED) mmapDir.setUseUnmap...
private void assertChunking(Random random, int chunkSize) throws Exception { File path = createTempDir("mmap" + chunkSize); MMapDirectory mmapDir = new MMapDirectory(path, null, chunkSize); // we will map a lot, try to turn on the unmap hack if (MMapDirectory.UNMAP_SUPPORTED) mmapDir.setUseUnmap...
public void testNRTAndCommit() throws Exception { Directory dir = newDirectory(); NRTCachingDirectory cachedDir = new NRTCachingDirectory(dir, 2.0, 25.0); MockAnalyzer analyzer = new MockAnalyzer(random()); analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 1, IndexWriter.MAX_TERM_LENGTH)); Ind...
public void testNRTAndCommit() throws Exception { Directory dir = newDirectory(); NRTCachingDirectory cachedDir = new NRTCachingDirectory(dir, 2.0, 25.0); MockAnalyzer analyzer = new MockAnalyzer(random()); analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 1, IndexWriter.MAX_TERM_LENGTH)); Ind...
public void testMmapIndex() throws Exception { // sometimes the directory is not cleaned by rmDir, because on Windows it // may take some time until the files are finally dereferenced. So clean the // directory up front, or otherwise new IndexWriter will fail. File dirPath = createTempDir("testLuceneM...
public void testMmapIndex() throws Exception { // sometimes the directory is not cleaned by rmDir, because on Windows it // may take some time until the files are finally dereferenced. So clean the // directory up front, or otherwise new IndexWriter will fail. File dirPath = createTempDir("testLuceneM...
public void testDummy() throws Exception { MockDirectoryWrapper dir = newMockDirectory(); dir.setAssertNoUnrefencedFilesOnClose(true); IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, null)); iw.addDocument(new Document()); iw.close(); IndexOutput...
public void testDummy() throws Exception { MockDirectoryWrapper dir = newMockDirectory(); dir.setAssertNoUnrefencedFilesOnClose(true); IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, null)); iw.addDocument(new Document()); iw.shutdown(); IndexOut...
public void testNoOrds() throws Exception { Directory dir = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), dir); Document doc = new Document(); FieldType ft = new FieldType(TextField.TYPE_NOT_STORED); ft.setStoreTermVectors(true); doc.add(new Field("foo", "this is a tes...
public void testNoOrds() throws Exception { Directory dir = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), dir); Document doc = new Document(); FieldType ft = new FieldType(TextField.TYPE_NOT_STORED); ft.setStoreTermVectors(true); doc.add(new Field("foo", "this is a tes...
public String stringValue() { return null; } }); try { iw.addDocument(invalidDoc); iw.commit(); } finally { int counter = 0; for (String fileName : dir.listAll()) { if (fileName.endsWith(".fdt") || fileName.endsWith(".fdx")) { cou...
public String stringValue() { return null; } }); try { iw.addDocument(invalidDoc); iw.commit(); } finally { int counter = 0; for (String fileName : dir.listAll()) { if (fileName.endsWith(".fdt") || fileName.endsWith(".fdx")) { cou...
public DocValuesFormat getDocValuesFormatForField(String field) { if ("dv1".equals(field)) { return fast; } else { return slow; } } }); IndexWriter iwriter = new IndexWriter(directory, iwc); Document doc = new Document(); String longTerm = "longter...
public DocValuesFormat getDocValuesFormatForField(String field) { if ("dv1".equals(field)) { return fast; } else { return slow; } } }); IndexWriter iwriter = new IndexWriter(directory, iwc); Document doc = new Document(); String longTerm = "longter...
public void testPostings() throws Exception { Directory dir = newFSDirectory(createTempDir("postings")); IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); iwc.setCodec(Codec.forName("Lucene40")); RandomIndexWriter iw = new RandomIndexWriter(random(), dir, ...
public void testPostings() throws Exception { Directory dir = newFSDirectory(createTempDir("postings")); IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); iwc.setCodec(Codec.forName("Lucene40")); RandomIndexWriter iw = new RandomIndexWriter(random(), dir, ...
public void testPerFieldCodec() throws Exception { final int NUM_DOCS = atLeast(173); if (VERBOSE) { System.out.println("TEST: NUM_DOCS=" + NUM_DOCS); } BaseDirectoryWrapper dir = newDirectory(); dir.setCheckIndexOnClose(false); // we use a custom codec provider IndexWriter w = new...
public void testPerFieldCodec() throws Exception { final int NUM_DOCS = atLeast(173); if (VERBOSE) { System.out.println("TEST: NUM_DOCS=" + NUM_DOCS); } BaseDirectoryWrapper dir = newDirectory(); dir.setCheckIndexOnClose(false); // we use a custom codec provider IndexWriter w = new...
private static void toDot(Automaton a) throws IOException { final String s = a.toDot(); Writer w = new OutputStreamWriter(new FileOutputStream("/x/tmp/out.dot")); w.write(s); w.close(); System.out.println("TEST: saved to /x/tmp/out.dot");
private static void toDot(Automaton a) throws IOException { final String s = a.toDot(); Writer w = new OutputStreamWriter(new FileOutputStream("/x/tmp/out.dot")); w.write(s); w.shutdown(); System.out.println("TEST: saved to /x/tmp/out.dot");
public int getOffsetGap(String fieldName) { return offsetGap; } }; final RandomIndexWriter writer = new RandomIndexWriter(random(), newDirectory()); final Document doc = new Document(); final FieldType ft = new FieldType(); ft.setIndexed(true); ft.setIndexOptions(IndexOption...
public int getOffsetGap(String fieldName) { return offsetGap; } }; final RandomIndexWriter writer = new RandomIndexWriter(random(), newDirectory()); final Document doc = new Document(); final FieldType ft = new FieldType(); ft.setIndexed(true); ft.setIndexOptions(IndexOption...
public boolean incrementToken() { if (index == tokens.length) { return false; } else { clearAttributes(); termAtt.append(tokens[index++]); offsetAtt.setOffset(0,0); return true; } } }; stream = new CachingT...
public boolean incrementToken() { if (index == tokens.length) { return false; } else { clearAttributes(); termAtt.append(tokens[index++]); offsetAtt.setOffset(0,0); return true; } } }; stream = new CachingT...
public void testDemo() throws IOException { Analyzer analyzer = new MockAnalyzer(random()); // Store the index in memory: Directory directory = newDirectory(); // To store an index on disk, use this instead: // Directory directory = FSDirectory.open(new File("/tmp/testindex")); RandomIndexWri...
public void testDemo() throws IOException { Analyzer analyzer = new MockAnalyzer(random()); // Store the index in memory: Directory directory = newDirectory(); // To store an index on disk, use this instead: // Directory directory = FSDirectory.open(new File("/tmp/testindex")); RandomIndexWri...
public void testNot() throws Exception { Directory store = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), store); Document d1 = new Document(); d1.add(newTextField("field", "a b", Field.Store.YES)); writer.addDocument(d1); IndexReader reader = writer.getReader(); ...
public void testNot() throws Exception { Directory store = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), store); Document d1 = new Document(); d1.add(newTextField("field", "a b", Field.Store.YES)); writer.addDocument(d1); IndexReader reader = writer.getReader(); ...
public void setUp() throws Exception { super.setUp(); directory = newDirectory(); PerFieldSimilarityWrapper sim = new ExampleSimilarityProvider(); IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setSimilarity(sim); RandomIndexWriter iw = new ...
public void setUp() throws Exception { super.setUp(); directory = newDirectory(); PerFieldSimilarityWrapper sim = new ExampleSimilarityProvider(); IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setSimilarity(sim); RandomIndexWriter iw = new ...
public TokenStreamComponents createComponents(String fieldName) { Tokenizer tokenizer = new MockTokenizer(MockTokenizer.SIMPLE, true); return new TokenStreamComponents(tokenizer, new SimplePayloadFilter(tokenizer)); } }; directory = newDirectory(); RandomIndexWriter wr...
public TokenStreamComponents createComponents(String fieldName) { Tokenizer tokenizer = new MockTokenizer(MockTokenizer.SIMPLE, true); return new TokenStreamComponents(tokenizer, new SimplePayloadFilter(tokenizer)); } }; directory = newDirectory(); RandomIndexWriter wr...
public static void beforeClass() throws Exception { directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); writer.addDocument(doc(new Field[] { field(...
public static void beforeClass() throws Exception { directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); writer.addDocument(doc(new Field[] { field(...
public void setUp() throws Exception { super.setUp(); // create test index mDirectory = newDirectory(); final RandomIndexWriter writer = new RandomIndexWriter(random(), mDirectory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, M...
public void setUp() throws Exception { super.setUp(); // create test index mDirectory = newDirectory(); final RandomIndexWriter writer = new RandomIndexWriter(random(), mDirectory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, M...
public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), directory); Document doc = new Document(); Field field = newTextField("field", "", Field.Store.NO); doc.add(field); field.setStringValue("quick brow...
public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter iw = new RandomIndexWriter(random(), directory); Document doc = new Document(); Field field = newTextField("field", "", Field.Store.NO); doc.add(field); field.setStringValue("quick brow...
public void setUp() throws Exception { super.setUp(); // create test index final RandomIndexWriter writer = new RandomIndexWriter(random(), mDirectory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET...
public void setUp() throws Exception { super.setUp(); // create test index final RandomIndexWriter writer = new RandomIndexWriter(random(), mDirectory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET...
public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); for (int i = 0; i < docFields.length; i++)...
public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); for (int i = 0; i < docFields.length; i++)...
public void testStartPositions() throws Exception { Directory dir = newDirectory(); // mimic StopAnalyzer CharacterRunAutomaton stopSet = new CharacterRunAutomaton(new RegExp("the|a|of").toAutomaton()); Analyzer analyzer = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, stopSet); ...
public void testStartPositions() throws Exception { Directory dir = newDirectory(); // mimic StopAnalyzer CharacterRunAutomaton stopSet = new CharacterRunAutomaton(new RegExp("the|a|of").toAutomaton()); Analyzer analyzer = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, stopSet); ...
public void setUp() throws Exception { super.setUp(); analyzer = new MockAnalyzer(random()); dir = newDirectory(); IndexWriterConfig config = newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer); config.setMergePolicy(newLogMergePolicy()); // we will use docids to validate RandomIndexWriter wr...
public void setUp() throws Exception { super.setUp(); analyzer = new MockAnalyzer(random()); dir = newDirectory(); IndexWriterConfig config = newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer); config.setMergePolicy(newLogMergePolicy()); // we will use docids to validate RandomIndexWriter wr...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); fieldName = random().nextBoolean() ? "field" : ""; // sometimes use an empty string as field name RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnal...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); fieldName = random().nextBoolean() ? "field" : ""; // sometimes use an empty string as field name RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnal...
public void testMultiValuedNRQ() throws Exception { Directory directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())) .setMaxBufferedDocs(TestUtil.nextInt(random(), 50, 1000))); ...
public void testMultiValuedNRQ() throws Exception { Directory directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())) .setMaxBufferedDocs(TestUtil.nextInt(random(), 50, 1000))); ...
public void testQuery() throws Exception { Directory dir = newDirectory(); IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(2).setMergePolicy(newLogMergePolicy())); addDoc("one", iw...
public void testQuery() throws Exception { Directory dir = newDirectory(); IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(2).setMergePolicy(newLogMergePolicy())); addDoc("one", iw...
private int[] buildIndex(RandomIndexWriter writer, int docs) throws IOException { int[] docStates = new int[docs]; for (int i = 0; i < docs; i++) { Document doc = new Document(); if (random().nextBoolean()) { docStates[i] = 1; doc.add(newTextField("some", "value", Field.Store...
private int[] buildIndex(RandomIndexWriter writer, int docs) throws IOException { int[] docStates = new int[docs]; for (int i = 0; i < docs; i++) { Document doc = new Document(); if (random().nextBoolean()) { docStates[i] = 1; doc.add(newTextField("some", "value", Field.Store...
public void testSparseIndex() throws IOException { Directory dir = newDirectory(); IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random()))); for (int d = -20; d <= 20; d++) { Document doc = new Document(); doc.add(new IntField("id_int"...
public void testSparseIndex() throws IOException { Directory dir = newDirectory(); IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random()))); for (int d = -20; d <= 20; d++) { Document doc = new Document(); doc.add(new IntField("id_int"...
public void testSort_2() throws Exception { testSort(true); } void testSort(boolean useFrom) 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...
public void testSort_2() throws Exception { testSort(true); } void testSort(boolean useFrom) 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...
public static void beforeClass() throws Exception { directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()) .setSimilarity(similarity)); //writer.infoStream = System.out; for (i...
public static void beforeClass() throws Exception { directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()) .setSimilarity(similarity)); //writer.infoStream = System.out; for (i...
public static void beforeClass() throws Exception { directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()) .setSimilarity(similarity).setMe...
public static void beforeClass() throws Exception { directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()) .setSimilarity(similarity).setMe...
public IndexSearcher setUp(Random random, Similarity similarity, int numDocs) throws IOException { Directory directory = new MockDirectoryWrapper(random, new RAMDirectory()); PayloadAnalyzer analyzer = new PayloadAnalyzer(); // TODO randomize this IndexWriter writer = new IndexWriter(directory, new I...
public IndexSearcher setUp(Random random, Similarity similarity, int numDocs) throws IOException { Directory directory = new MockDirectoryWrapper(random, new RAMDirectory()); PayloadAnalyzer analyzer = new PayloadAnalyzer(); // TODO randomize this IndexWriter writer = new IndexWriter(directory, new I...
public static void beforeClassTestExplanations() throws Exception { directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); for (int i = 0; i < docFields.le...
public static void beforeClassTestExplanations() throws Exception { directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random(), directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); for (int i = 0; i < docFields.le...
public static void beforeClass() throws Exception { 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" }; small = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), small, ...
public static void beforeClass() throws Exception { 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" }; small = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), small, ...
public void testMissingTerms() throws Exception { String fieldName = "field1"; Directory rd = newDirectory(); RandomIndexWriter w = new RandomIndexWriter(random(), rd); for (int i = 0; i < 100; i++) { Document doc = new Document(); int term = i * 10; //terms are units of 10; doc.add(...
public void testMissingTerms() throws Exception { String fieldName = "field1"; Directory rd = newDirectory(); RandomIndexWriter w = new RandomIndexWriter(random(), rd); for (int i = 0; i < 100; i++) { Document doc = new Document(); int term = i * 10; //terms are units of 10; doc.add(...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); fieldName = random().nextBoolean() ? "field" : ""; // sometimes use an empty string as field name RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnal...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); fieldName = random().nextBoolean() ? "field" : ""; // sometimes use an empty string as field name RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnal...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())) .setMaxBufferedDocs(TestUtil.nextInt(random(), 50, 1000))); Document d...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())) .setMaxBufferedDocs(TestUtil.nextInt(random(), 50, 1000))); Document d...
public void testOutOfOrderCollection() throws Exception { Directory dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), dir); for (int i = 0; i < 10; i++) { writer.addDocument(new Document()); } boolean[] inOrder = new boolean[] { false, true }; String[]...
public void testOutOfOrderCollection() throws Exception { Directory dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), dir); for (int i = 0; i < 10; i++) { writer.addDocument(new Document()); } boolean[] inOrder = new boolean[] { false, true }; String[]...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())) .setMaxBufferedDocs(TestUtil.nextInt(random(), 50, 1000))); Document d...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())) .setMaxBufferedDocs(TestUtil.nextInt(random(), 50, 1000))); Document d...
public static void beforeClass() throws Exception { dir = newDirectory(); sdir1 = newDirectory(); sdir2 = newDirectory(); final RandomIndexWriter writer = new RandomIndexWriter(random(), dir, new MockAnalyzer(random())); final RandomIndexWriter swriter1 = new RandomIndexWriter(random(), sdir1, new...
public static void beforeClass() throws Exception { dir = newDirectory(); sdir1 = newDirectory(); sdir2 = newDirectory(); final RandomIndexWriter writer = new RandomIndexWriter(random(), dir, new MockAnalyzer(random())); final RandomIndexWriter swriter1 = new RandomIndexWriter(random(), sdir1, new...
private static IndexReader build(Random random, TestIndex index) throws IOException { /* build an index */ Document doc = new Document(); Field idField = newStringField(random, "id", "", Field.Store.YES); Field intIdField = new IntField("id_int", 0, Store.YES); Field floatIdField = new FloatF...
private static IndexReader build(Random random, TestIndex index) throws IOException { /* build an index */ Document doc = new Document(); Field idField = newStringField(random, "id", "", Field.Store.YES); Field intIdField = new IntField("id_int", 0, Store.YES); Field floatIdField = new FloatF...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.KEYWORD, false)) .setMaxBufferedDocs(TestUtil.nextInt(random(), 5...
public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.KEYWORD, false)) .setMaxBufferedDocs(TestUtil.nextInt(random(), 5...
public void setUp() throws Exception { super.setUp(); analyzer = new MockAnalyzer(random()); dir = newDirectory(); IndexWriterConfig config = newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer); config.setMergePolicy(newLogMergePolicy()); // we will use docids to validate RandomIndexWriter wr...
public void setUp() throws Exception { super.setUp(); analyzer = new MockAnalyzer(random()); dir = newDirectory(); IndexWriterConfig config = newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer); config.setMergePolicy(newLogMergePolicy()); // we will use docids to validate RandomIndexWriter wr...
public void setUp() throws Exception { super.setUp(); counter = Counter.newCounter(true); counterThread = new TimerThread(counter); counterThread.start(); final String docText[] = { "docThatNeverMatchesSoWeCanRequireLastDocCollectedToBeGreaterThanZero", "one blah three", "o...
public void setUp() throws Exception { super.setUp(); counter = Counter.newCounter(true); counterThread = new TimerThread(counter); counterThread.start(); final String docText[] = { "docThatNeverMatchesSoWeCanRequireLastDocCollectedToBeGreaterThanZero", "one blah three", "o...
public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory); Document doc = new Document(); Field titleField = newTextField("title", "some title", Field.Store.NO); Field field = newTextField(FN, "", Fie...
public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory); Document doc = new Document(); Field titleField = newTextField("title", "some title", Field.Store.NO); Field field = newTextField(FN, "", Fie...
public static void makeIndex() throws Exception { dir = new RAMDirectory(); RandomIndexWriter w = new RandomIndexWriter( random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); // make sure we have more than one segment occational...
public static void makeIndex() throws Exception { dir = new RAMDirectory(); RandomIndexWriter w = new RandomIndexWriter( random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy())); // make sure we have more than one segment occational...
public static void beforeClass() throws Exception { directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory); Document doc = new Document(); Field field = newStringField(FIELD, "meaninglessnames", Field.Store.NO); doc.add(field); for (int i = 0; i...
public static void beforeClass() throws Exception { directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory); Document doc = new Document(); Field field = newStringField(FIELD, "meaninglessnames", Field.Store.NO); doc.add(field); for (int i = 0; i...
public void testGetScores() throws Exception { Directory directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory); writer.commit(); IndexReader ir = writer.getReader(); writer.close(); IndexSearcher searcher = newSearcher(ir);
public void testGetScores() throws Exception { Directory directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random(), directory); writer.commit(); IndexReader ir = writer.getReader(); writer.shutdown(); IndexSearcher searcher = newSearcher(ir);
public static void beforeClass() throws Exception { 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 static void beforeClass() throws Exception { 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" }; ...