avoid using deprecated QueryParser method

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@347995 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2005-11-21 21:46:26 +00:00
parent dea69e3360
commit c78c2c8936
1 changed files with 5 additions and 6 deletions

View File

@ -27,7 +27,8 @@ import org.apache.lucene.search.Hits;
import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.queryParser.QueryParser;
public class TestKeywordAnalyzer extends TestCase { public class TestKeywordAnalyzer extends TestCase {
RAMDirectory directory;
private RAMDirectory directory;
private IndexSearcher searcher; private IndexSearcher searcher;
public void setUp() throws Exception { public void setUp() throws Exception {
@ -47,13 +48,11 @@ public class TestKeywordAnalyzer extends TestCase {
} }
public void testPerFieldAnalyzer() throws Exception { public void testPerFieldAnalyzer() throws Exception {
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper( PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new SimpleAnalyzer());
new SimpleAnalyzer());
analyzer.addAnalyzer("partnum", new KeywordAnalyzer()); analyzer.addAnalyzer("partnum", new KeywordAnalyzer());
Query query = QueryParser.parse("partnum:Q36 AND SPACE", QueryParser queryParser = new QueryParser("description", analyzer);
"description", Query query = queryParser.parse("partnum:Q36 AND SPACE");
analyzer);
Hits hits = searcher.search(query); Hits hits = searcher.search(query);
assertEquals("Q36 kept as-is", assertEquals("Q36 kept as-is",