You are creating a TermScorer on a composite (non atomic IndexReader like SegmentReader). That's still supported in 3.x, but no longer allowed in 4.0. The backwards layer in 3.x had a bug before Lucene 3.5, so theoretically your code should work on 3.5: https://issues.apache.org/jira/browse/LUCENE-3442
But still: null is a valid return value for scorer()!!! It may return null, if no document can match this query. Means the term does not exist at all. Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Michael Kazekin [mailto:michael.kaze...@mediainsight.info] > Sent: Friday, January 27, 2012 4:39 PM > To: java-user@lucene.apache.org > Subject: Null scorer constructed by TermQuery > > Hi! > > I have a Solr-constructed index, which I read with this code: > > Directory directory = FSDirectory.open(file); IndexReader reader = > IndexReader.open(directory, true); IndexSearcher searcher = new > IndexSearcher(reader); > > I try to get a Scorer with this TermQuery ("lang" field is indexed and stored and > all data is available) > > TermQuery atomQuery = new TermQuery(new Term("lang", "ru")); > > Weight weight = atomQuery.createWeight(searcher); Scorer scorer = > weight.scorer(reader, true, false); > > > > after this scorer is null. > > > > Does anyone know, what could be the problem here? > > I tried it with Solr. 3.4 and with Solr 3.5, results are the same. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org