lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: ESCAPING BUG \(abc\) and \(a*c\) in v1.2
Date Mon, 03 Feb 2003 19:35:01 GMT
Try replacing StandardAnalyzer with WhitespaceAnalyzer.
Works, right?
If so, the bug reports is invalid probably.

Otis

--- Lukas Zapletal <lzap@root.cz> wrote:
> Hello all,
> 
> I posted Escaping bug earlier to this list and bugzilla, but it was 
> rejected. I fixed the testing code, now it is created with same 
> StandardAnalyzers and the problem is still there. Can anybody help
> me? 
> Can anybody test it? Please help me it is important to me!
> 
> I`m also creating Bugzilla record too.
> 
> import junit.framework.*;
> import org.apache.lucene.index.*;
> import org.apache.lucene.analysis.*;
> import org.apache.lucene.analysis.standard.*;
> import org.apache.lucene.store.*;
> import org.apache.lucene.document.*;
> import org.apache.lucene.search.*;
> import org.apache.lucene.queryParser.*;
> 
> /**
>  * Escape bug (now with same analyzers). By lzap@root.cz.
>  * Here is the description:
>  *
>  * When searching for \(abc\) everything is ok. But let`s search for:
> 
> \(a?c\)
>  * YES! Nothing found! It`s same with \" and maybe other escaped 
> characters.
>  *
>  * User: Lukas Zapletal
>  * Date: Feb 1, 2003
>  *
>  * JUnit test case follows:
>  */
> public class juEscapeBug extends TestCase {
>     Directory dir = new RAMDirectory();
>     String testText = "This is a test. (abc) Is there a bug OR not? 
> \"Question\"!";
> 
>     public juEscapeBug(String tn) {
>         super(tn);
>     }
> 
>     protected void setUp() throws Exception {
>         IndexWriter writer = new IndexWriter(dir, new 
> StandardAnalyzer(), true);
>         Document doc = new Document();
>         doc.add(Field.Text("contents", testText));
>         writer.addDocument(doc);
>         writer.optimize();
>         writer.close();
>     }
> 
>     private boolean doQuery(String queryString) throws Exception {
>         Searcher searcher = new IndexSearcher(dir);
>         Analyzer analyzer = new StandardAnalyzer();
>         Query query = QueryParser.parse(queryString, "contents",
> analyzer);
>         Hits hits = searcher.search(query);
>         searcher.close();
>         return (hits.length() == 1);
>     }
> 
>     public void testBugOk1() throws Exception {
>         assertTrue(doQuery("Test"));
>     }
>     public void testBugOk2() throws Exception {
>         assertFalse(doQuery("This is not there"));
>     }
>     public void testBugOk3() throws Exception {
>         assertTrue(doQuery("abc"));
>     }
>     public void testBugOk4() throws Exception {
>         assertTrue(doQuery("\\(abc\\)"));
>     }
>     public void testBugHere1() throws Exception {
>         assertTrue(doQuery("\\(a?c\\)")); // BUG HERE !!!
>     }
>     public void testBugHere2() throws Exception {
>         assertTrue(doQuery("\\(a*\\)")); // BUG HERE !!!
>     }
>     public void testBugHere3() throws Exception {
>         assertTrue(doQuery("\\\"qu*on\\\"")); // BUG HERE !!!
>     }
> }
> 
> -- 
> Lukas Zapletal      [lzap@root.cz]
> http://www.tanecni-olomouc.cz/lzap
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


Mime
View raw message