Hi there, I'm searching across an index with two different Query objects, that is TermQuery and PhraseQuery. Altough the index definitely exists the search with these objects doesn't return any hits:
if(searchTerms[i].contains(" ")) { PhraseQuery phraseQuery = new PhraseQuery(); StringTokenizer tok = new StringTokenizer(searchTerms[i], " "); while(tok.hasMoreTokens()) { Term term = new Term(fields[i], tok.nextToken()); phraseQuery.add(term); } phraseQuery.setSlop(1); TopDocs docs = is.search(phraseQuery, 10); hits = is.search(phraseQuery); } else { Term term = new Term(fields[i], searchTerms[i]); TermQuery termQuery = new TermQuery(term); hits = is.search(termQuery); } On the other side this seems to work: QueryParser qp = new QueryParser("textData", analyzer); Query query = qp.parse(content); hits = is.search(query); for(int i = 0; i < hits.length(); i++) { Document doc = hits.doc(i); } I don't understand why the upper query doesn't return any results but the lower does. Anyone experienced the same problem? -- View this message in context: http://lucene.472066.n3.nabble.com/Search-doesn-t-return-any-hits-but-should-tp3431015p3431015.html Sent from the Lucene - General mailing list archive at Nabble.com.