If you have to use a tokenized field, then an alternative(but not good) solution may be:
string strQuery = ""; TermEnum te = searcher.GetIndexReader().Terms(new Term("productName", "chat")); do{ Term t = te.Term(); if (t.text.StartsWith("chat") == false) break; strQuery += "productName:\"sudhanya " + t.text + "\"~1 "; } while (te.Next()); QueryParser qp = new QueryParser("productName", new StandardAnalyzer()); Query q = qp.Parse(strQuery); DIGY -----Original Message----- From: Michael Garski [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2008 9:15 PM To: lucene-net-user@incubator.apache.org Subject: RE: Query with wildcard characters Sudhanya, It sounds like you are tokenizing the text that you are searching for a wildcard. If you want the multi-word items to be considered one term that can be searched with a wildcard, don't tokenize those fields. From your description, it looks like the productName field is tokenized, which is why you are getting items that start with "Chat". Michael -----Original Message----- From: Sudhanya Chatterjee [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2008 1:28 AM To: lucene-net-user@incubator.apache.org Subject: Query with wildcard characters Hi, How to create queries of the following type using query parser (for tokenized as well as untokenized fields) - Sudhanya Chat* In the result I want all fields which start with "Sudhanya Chat". But if I create a query - Query qry = queryParse.Parse("productName: Sudhanya Chat*"); I get fields which are just starting with "Chat". I have tried both - keyword and standard Analyzer. How do I achieve the above mentioned kind of behaviour? Thanks, Sudhanya DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.