more deprecation fixes

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@387575 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2006-03-21 16:26:10 +00:00
parent 3666a166a1
commit 2d7dbf8131
5 changed files with 16 additions and 17 deletions

View File

@ -1030,8 +1030,11 @@ public class MemoryIndex {
protected void doClose() {
if (DEBUG) System.err.println("MemoryIndexReader.doClose");
}
// lucene <= 1.4.3
// lucene <= 1.4.3
public Collection getFieldNames() {
if (DEBUG) System.err.println("MemoryIndexReader.getFieldNames");
return getFieldNames(true);

View File

@ -350,12 +350,7 @@ public class MemoryIndexTest extends TestCase {
private Document createDocument(String content) {
Document doc = new Document();
{ // lucene-1.4.3
doc.add(Field.UnStored(FIELD_NAME, content));
}
// { // lucene >= 1.9
// doc.add(new Field(FIELD_NAME, content, Field.Store.NO, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS));
// }
doc.add(new Field(FIELD_NAME, content, Field.Store.NO, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS));
return doc;
}
@ -374,8 +369,7 @@ public class MemoryIndexTest extends TestCase {
IndexWriter writer = null;
try {
writer = new IndexWriter(dir, analyzer, true);
writer.maxFieldLength = Integer.MAX_VALUE; // ensure large files are scored correctly
// writer.setMaxFieldLength(Integer.MAX_VALUE);
writer.setMaxFieldLength(Integer.MAX_VALUE);
writer.addDocument(doc);
writer.optimize();
return dir;

View File

@ -105,7 +105,7 @@ public final class SimilarityQueries
TermQuery tq = new TermQuery( new Term( field, word));
try
{
tmp.add( tq, false, false);
tmp.add( tq, BooleanClause.Occur.SHOULD);
}
catch( BooleanQuery.TooManyClauses too)
{

View File

@ -121,9 +121,9 @@ public class ListSearcher extends AbstractListModel {
//this will allow us to retrive the results later
//and map this list model's row to a row in the decorated
//list model
document.add(new Field(ROW_NUMBER, "" + row, true, true, true));
document.add(new Field(ROW_NUMBER, "" + row, Field.Store.YES, Field.Index.TOKENIZED));
//add the string representation of the row to the index
document.add(new Field(FIELD_NAME, String.valueOf(listModel.getElementAt(row)).toLowerCase(), true, true, true));
document.add(new Field(FIELD_NAME, String.valueOf(listModel.getElementAt(row)).toLowerCase(), Field.Store.YES, Field.Index.TOKENIZED));
writer.addDocument(document);
}
writer.optimize();
@ -161,7 +161,8 @@ public class ListSearcher extends AbstractListModel {
//build a query based on the fields, searchString and cached analyzer
//NOTE: This is an area for improvement since the MultiFieldQueryParser
// has some weirdness.
Query query = MultiFieldQueryParser.parse(searchString, fields, analyzer);
MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer);
Query query =parser.parse(searchString);
//run the search
Hits hits = is.search(query);
//reset this list model with the new results

View File

@ -176,14 +176,14 @@ public class TableSearcher extends AbstractTableModel {
//this will allow us to retrive the results later
//and map this table model's row to a row in the decorated
//table model
document.add(new Field(ROW_NUMBER, "" + row, true, true, true));
document.add(new Field(ROW_NUMBER, "" + row, Field.Store.YES, Field.Index.TOKENIZED));
//iterate through all columns
//index the value keyed by the column name
//NOTE: there could be a problem with using column names with spaces
for (int column=0; column < tableModel.getColumnCount(); column++){
String columnName = tableModel.getColumnName(column);
String columnValue = String.valueOf(tableModel.getValueAt(row, column)).toLowerCase();
document.add(new Field(columnName, columnValue, true, true, true));
document.add(new Field(columnName, columnValue, Field.Store.YES, Field.Index.TOKENIZED));
}
writer.addDocument(document);
}
@ -246,7 +246,8 @@ public class TableSearcher extends AbstractTableModel {
//build a query based on the fields, searchString and cached analyzer
//NOTE: This is an area for improvement since the MultiFieldQueryParser
// has some weirdness.
Query query = MultiFieldQueryParser.parse(searchString, fields, analyzer);
MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer);
Query query = parser.parse(searchString);
//run the search
Hits hits = is.search(query);
//reset this table model with the new results