Can you provide the full stack trace? Mike McCandless
http://blog.mikemccandless.com On Fri, Jan 25, 2013 at 11:13 AM, JimAld <[email protected]> wrote: > Hi, > > The below code is throwing the exception: > java.lang.NumberFormatException: For input string: "000001.SZ" at > java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) > > when the "TopDocs docs = indexSearcher.search(phraseQuery, null, 10, sort);" > line is called. This only happens when the searchPattern contains a space > character. No other info is available in the exception. > > The "000001.SZ" value is the first value in my index... > the index is a RAMDirectory... > > Anyone have any ideas? Many Thanks. > > Code: > BooleanQuery.setMaxClauseCount(clauseCount); > searchPattern = QueryParser.escape(searchPattern); > Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40); > IndexReader reader = IndexReader.open(index); > IndexSearcher indexSearcher = new IndexSearcher(reader); > > PhraseQuery phraseQuery = new PhraseQuery(); > Term term = new Term(fieldName, searchPattern); > phraseQuery.add(term); > phraseQuery.setSlop(0); > > Sort sort = new Sort(new SortField(fieldName,SortField.Type.SCORE)); > TopDocs docs = indexSearcher.search(phraseQuery, null, 10, sort); > > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/java-lang-NumberFormatException-Using-PhraseQuery-with-Lucene-4-0-0-tp4036273.html > Sent from the Lucene - Java Developer mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
