Hi,
Am new to Lucene. I found the following page: http://lucene.apache.org/java/docs/queryparsersyntax.html. At the bottom of the page there is a section that in order to escape special characters one would use "\". I have an Indexer that indexes product names. Some product names have "-" character in them. When I use my search class to search for product names with - in them it wont find those products. The code below returns no result. public void searchIndex() { try { SearchManager sm = new ManagerFactory().getSearchManager(); String searchPath = "Product-search-index"; sm.initIndex(searchPath); sm.buildIndex(this.daoFactory); String tk = "Chimi-Bose-765"; if(tk.contains("-")); tk = tk.replaceAll("-" , "\\-"); if(tk != null && tk.trim().equals("") == false) tk = tk + "*"; else tk = ""; try { Hits hits = sm.search(searchPath, tk); if(hits != null && hits.length() > 0) { int length = hits.length(); log.info(length + " result(s) were found matching your search criteria."); for(int i = 0; i < length; i++) { Document doc = hits.doc(i); log.info("Score: " + hits.score(i) + " Product id = " + doc.getField("id").stringValue() + " prod name = " + doc.getField("name").stringValue()); } } else log.info("No results were found matching your search."); } catch(IOException ex) { ex.printStackTrace(); } catch(Exception ex) { log.info("No results were found matching your search."); } } catch (Exception ex) { ex.printStackTrace(); Assert.fail(); } } ------------------------------------------------------------------------------------------ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Consult your physician prior to the use of any medical supplies or product. ------------------------------------------------------------------------------------------