> I'm trying to fix my code to remove everything that is deprecated in order > to move to Lucene 3.0. I fixed many many items but I can't find the answer > to some answers. See items in red below: > > *#1. Opening an index* > *idx = FSDirectory.getDirectory(new File(INDEX)); > reader = IndexReader.open(idx, true); > searcher = new IndexSearcher(reader); > > *The function "getDirectory" is deprecated
Two possibilities: a) instantiate the FSDirectory subclass yourself (e.g. MMapDirectory, SimpleFSDirectory of NIOFSDirectory) b) use FSDirectory.open() which chooses automatically depending on operating system. > *#2. QueryFilter / RangeFilter* > *cluFilters[i] = new QueryFilter(tmpQ); > cluFilters[i] = new RangeFilter(FILTERS_FIELD[i], FILTERS_VALUE_LOW[i], > FILTERS_VALUE_HIGH[i], true, true);* > > QueryFilter and RangeFilter are deprecated. Read the Javadocs there is a hint how to fix. RangeFilter is now TermRangeFilter (if it should work on terms) or NumericRangeFilter (if it should work on the new NumericField fields, reindexing required!) QueryFilter is replaced by QueryWrapperFilter and additionally a CachingWrapperFilter. > *#3. Looping a document's fields* > *Enumeration<?> cluDFE = cluDoc.fields(); > while ( cluDFE.hasMoreElements() ) > { > Field field = (Field)cluDFE.nextElement();* > ... > > The Document's fields() function is deprecated. Only the enumeration one is deprecated. Use the one returning a List<Fieldable> getFields() and request an iterator(). This is also in the Javadocs. All your questions are answered in the Javadocs, just open them and read! Uwe --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org