lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AlisonCallahan <>
Subject PrefixQuery returning 0 results
Date Wed, 17 Feb 2010 15:39:02 GMT

I have indexed RDF in N-triple format (with three fields -- "subject",
"predicate", "object") and now am trying to query the index with a
PrefixQuery on the "subject" field. My test case is to get back all
documents whose subject field starts with the prefix "<http", and I would
expect to get back all documents. Instead, the PrefixQuery returns 0
documents. I have read and can't see why the PrefixQuery is returning 0

Here is the relevant code:

	IndexReader n3reader = File(index)),
	Searcher searcher = new IndexSearcher(n3reader);
	Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);

	String test = "<http";

	Query nsQuery = new PrefixQuery(new Term("subject", test));
	TopDocs hits =, 10);

	System.out.println("Hits: "+hits.totalHits);

This code prints out '0' hits ... Any suggestions for why this isn't
working?? Thanks,

Alison Callahan
View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message