You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shai Erera (JIRA)" <ji...@apache.org> on 2011/01/25 14:54:43 UTC

[jira] Closed: (LUCENE-83) ESCAPING BUG \(abc\) and \(a*c\) in v1.2

     [ https://issues.apache.org/jira/browse/LUCENE-83?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shai Erera closed LUCENE-83.
----------------------------

    Resolution: Not A Problem
      Assignee:     (was: Lucene Developers)

I verified on both 3x and trunk, queries like "\\(a?c\\)" and "\\(a*c\\)" work (return the correct result). I guess it was a problem fixed already in QP at some point.

> ESCAPING BUG \(abc\) and \(a*c\) in v1.2
> ----------------------------------------
>
>                 Key: LUCENE-83
>                 URL: https://issues.apache.org/jira/browse/LUCENE-83
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: QueryParser
>    Affects Versions: 1.2
>         Environment: Operating System: Windows XP
> Platform: All
>            Reporter: Lukas Zapletal
>            Priority: Minor
>
> PLEASE TEST THIS CODE:
> ----------------------------------------------
> 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 !!!
>     }
> }

-- 
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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org