You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by bu...@apache.org on 2005/06/17 15:45:54 UTC

DO NOT REPLY [Bug 35399] New: - Lucene 'not-contains' search gives NullPointerException

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35399>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35399

           Summary: Lucene 'not-contains' search gives NullPointerException
           Product: Slide
           Version: Nightly
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Search
        AssignedTo: slide-dev@jakarta.apache.org
        ReportedBy: tomekem@poczta.fm


For query:

<D:basicsearch xmlns:D=\"DAV:\">
  <D:select><D:allprop /></D:select> 
<D:from><D:scope><D:href>/files/</D:href><D:depth>infinity</D:depth></D:scope></D:from>
  <D:where>
    <D:and><D:not-is-collection
/><D:and><D:not-contains>secret</D:not-contains></D:and></D:and>
  </D:where>
</D:basicsearch>

there is NullPointerException:

Exception in thread "main" java.lang.NullPointerException
	at
org.apache.slide.index.lucene.IndexConfiguration$AnalyzerImpl.tokenStream(IndexConfiguration.java:421)
	at
org.apache.slide.index.lucene.expressions.ContainsExpression.termOrPhraseQuery(ContainsExpression.java:81)
	at
org.apache.slide.index.lucene.expressions.ContainsExpression.<init>(ContainsExpression.java:70)
	at
org.apache.slide.index.lucene.LuceneExpressionFactory.createDAVExpression(LuceneExpressionFactory.java:176)
	at
org.apache.slide.index.lucene.LuceneExpressionFactory.createExpression(LuceneExpressionFactory.java:145)
	at
org.apache.slide.search.basic.BasicExpressionCompiler.createExpression(BasicExpressionCompiler.java:233)
	at
org.apache.slide.search.basic.BasicExpressionCompiler.compile(BasicExpressionCompiler.java:132)
	at
org.apache.slide.search.basic.BasicExpressionCompiler.compile(BasicExpressionCompiler.java:125)
	at
org.apache.slide.search.basic.BasicExpressionCompiler.compile(BasicExpressionCompiler.java:125)
	at org.apache.slide.search.basic.BasicQueryImpl.parseQuery(BasicQueryImpl.java:204)
	at
org.apache.slide.search.basic.BasicQueryImpl.parseQueryElement(BasicQueryImpl.java:267)
	at
org.apache.slide.search.basic.BasicQueryEnvelope.parseQueryElement(BasicQueryEnvelope.java:176)
	at
org.apache.slide.search.basic.BasicSearchLanguage.parseQuery(BasicSearchLanguage.java:160)
	at org.apache.slide.search.SearchImpl.createSearchQuery(SearchImpl.java:251)
	at org.apache.slide.search.SearchImpl.createSearchQuery(SearchImpl.java:217)
	at my.test.SlideVersionsTest.search(SlideVersionsTest.java:448)
	at my.test.SlideVersionsTest.main(SlideVersionsTest.java:497)

In my opinion there is a bug in BasicExpressionCompiler class in method
'isContentExpression'. It only checks if given element is equal to
Literals.CONTAINS. In result expression is created with
'propertiesExpressionFactory' instead of 'contentExpressionFactory' in
'createExpression' method within same class.

After fixing org/apache/slide/search/basic/BasicExpressionCompiler.java

<             isContent =  Literals.CONTAINS.equals(expressionElement.getName()) ||
<               Literals.NOT_CONTAINS.equals(expressionElement.getName());
---
>             isContent =  Literals.CONTAINS.equals(expressionElement.getName());

query is working fine.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org