[ 
https://issues.apache.org/jira/browse/LUCENE-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476671
 ] 

Yonik Seeley commented on LUCENE-819:
-------------------------------------

I really don't see a need to change any code.  People aren't making mistakes 
constructing Terms, this just sounds like a buggy analyzer.

Personally I'd rather not even add a check for null in the constructor for 
Term... it's unnecessary extra code that precludes one from creating a Term 
with a null value as an application specific marker, or a template (for 
Term.createTerm()).

> Empty string or null would be the same thing from the point of view of our 
> application.
I think the correct place to fix this is your application.
If null and "" are synonymous to you, just fix your application to use "".

If we ever were to explicitly support "null" for termText, it seems like "no 
value" would make more sense than "zero length value".  (AFAIK, Lucene supports 
zero length terms)


> NullPointerException in Term.compareTo()
> ----------------------------------------
>
>                 Key: LUCENE-819
>                 URL: https://issues.apache.org/jira/browse/LUCENE-819
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>         Environment: JDK 1.4 on MacOS
>            Reporter: Dan Zivkovic
>         Attachments: lucene-819.patch, lucene-819.patch, TestTerm.java
>
>
>  java.lang.NullPointerException
>       at org.apache.lucene.index.Term.compareTo(Term.java:84)
>       at 
> org.apache.lucene.index.TermInfosReader.getIndexOffset(TermInfosReader.java:115)
>       at org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:150)
>       at org.apache.lucene.index.SegmentReader.docFreq(SegmentReader.java:300)
>       at org.apache.lucene.search.IndexSearcher.docFreq(IndexSearcher.java:78)
>       at org.apache.lucene.search.Similarity.idf(Similarity.java:255)
>       at 
> org.apache.lucene.search.TermQuery$TermWeight.<init>(TermQuery.java:43)
>       at org.apache.lucene.search.TermQuery.createWeight(TermQuery.java:142)
>       at 
> org.apache.lucene.search.BooleanQuery$BooleanWeight.<init>(BooleanQuery.java:203)
>       at 
> org.apache.lucene.search.BooleanQuery$BooleanWeight2.<init>(BooleanQuery.java:330)
>       at 
> org.apache.lucene.search.BooleanQuery.createWeight(BooleanQuery.java:372)
>       at org.apache.lucene.search.Query.weight(Query.java:93)
>       at org.apache.lucene.search.Hits.<init>(Hits.java:48)
>       at org.apache.lucene.search.Searcher.search(Searcher.java:53)
>         ...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to