From lucene-dev-return-4855-apmail-jakarta-lucene-dev-archive=jakarta.apache.org@jakarta.apache.org Mon Dec 22 09:35:43 2003 Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@www.apache.org Received: (qmail 79976 invoked from network); 22 Dec 2003 09:35:43 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 22 Dec 2003 09:35:43 -0000 Received: (qmail 68918 invoked by uid 500); 22 Dec 2003 09:35:26 -0000 Delivered-To: apmail-jakarta-lucene-dev-archive@jakarta.apache.org Received: (qmail 68778 invoked by uid 500); 22 Dec 2003 09:35:25 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 68764 invoked from network); 22 Dec 2003 09:35:25 -0000 Received: from unknown (HELO exchange.sun.com) (192.18.33.10) by daedalus.apache.org with SMTP; 22 Dec 2003 09:35:25 -0000 Received: (qmail 6748 invoked by uid 50); 22 Dec 2003 09:35:38 -0000 Date: 22 Dec 2003 09:35:38 -0000 Message-ID: <20031222093538.6747.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: lucene-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 6091] - QueryParser not recognizing asterisk with UTF-8 index X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6091 QueryParser not recognizing asterisk with UTF-8 index ------- Additional Comments From tero@favorin.com 2003-12-22 09:35 ------- The following test prog returns: Found id: 1 Found id: 1 Found id: The last search should find the index 1 as well. Tested with lucene-1.3-rc3. ----------------------------- import org.apache.lucene.analysis.*; import org.apache.lucene.index.*; import org.apache.lucene.document.*; import org.apache.lucene.search.*; import org.apache.lucene.queryParser.*; import java.io.*; /** * Self contained test for Lucene indexes. */ public class LuceneTest { public static void main(String args[]) { String outdirname="/tmp/testidx"; // Index directory try { // Creates index directory, if necessary. File outdir=new File(outdirname); if (!outdir.exists()) outdir.mkdir(); // Create an index with a single document. Analyzer analyzer=new SimpleAnalyzer(); IndexWriter writer = new IndexWriter(outdirname,analyzer,true); addDoc(writer,1, "för"); // The second letter is o with two dots. writer.optimize(); writer.close(); // Search the index. Searcher searcher=new IndexSearcher(outdirname); searchDoc(analyzer,searcher,"för"); // Ok searchDoc(analyzer,searcher,"f*"); // Ok searchDoc(analyzer,searcher,"fö*"); // Wrong! Does not find anything. } catch (Exception e) { e.printStackTrace(); return; } } /** * Add a document to index. * The text is changed to UTF-8. */ private static void addDoc(IndexWriter writer,int id,String text) throws Exception { Document doc=new Document(); doc.add(new Field("id",Long.toString(id),true,false,false)); doc.add(new Field("text",new String(text.getBytes("UTF-8")),false,true,true)); writer.addDocument(doc); } /** * Search the index. * The text is changed to UTF-8. */ private static void searchDoc(Analyzer analyzer, Searcher searcher, String text) throws Exception { Query q=QueryParser.parse(new String(text.getBytes("UTF-8")),"text",analyzer); Hits hits=searcher.search(q); System.out.println("Found id:"); for (int i=0;i