> > > writer = new IndexWriter("C:\\", new StandardAnalyzer(), true); > > Term term = new Term("line", "KOREA"); > > PhraseQuery query = new PhraseQuery(); > > query.add(term); >
StandardAnalyzer - used here while indexing - applies lowercasing. The query is created programatically - i.e. without a QueryParser and in particular without tokenization (~analysis) - and so "KOREA", while at indexing time would have been lowercased to "korea", at search time will remain as "KOREA" and hence search will not find it. For a few more useful hints see the FAQ entry "Why am I getting no hits / incorrect hits?" Doron