Do'H , Please disregard the message
forgot to assign the return value when i create the indexreader
Rupinder Singh Mazara wrote:
Hi all
while executing a query on lucene i get the following execption, if
a check for the IndexSearcher object == nulll
or a assert i donot get any errors ? Please help me out on this .
java.lang.NullPointerException
at
org.apache.lucene.search.IndexSearcher.docFreq(IndexSearcher.java:69)
at org.apache.lucene.search.Similarity.idf(Similarity.java:255)
at
org.apache.lucene.search.TermQuery$TermWeight.sumOfSquaredWeights(TermQuery.java:47)
at
org.apache.lucene.search.BooleanQuery$BooleanWeight.sumOfSquaredWeights(BooleanQuery.java:110)
at org.apache.lucene.search.Query.weight(Query.java:86)
at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:85)
To access the Searchable object I use the following lines of code, at
various places in my web application, all was fine till this morning and
running command line test scripts does not show a error
public static IndexReader fetchCitationReader(ServletContext context)
throws IOException {
IndexReader rval = (IndexReader)
context.getAttribute("luceneIndexReader");
if (rval == null) {
String var = (String) context.getAttribute("luceneRootName");
System.out.println("var = " + var);
IndexReader indexReader = IndexReader.open(new File(var));
context.setAttribute("luceneIndexReader", indexReader);
}
return rval;
}
public static Searcher fetchCitationSearcher(ServletContext context)
throws IOException {
Searcher rval = (Searcher)
context.getAttribute("luceneSearchable");
if (rval == null) {
rval = new IndexSearcher(fetchCitationReader(context));
context.setAttribute("luceneSearchable", rval);
}
return rval;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]