|  | 
| 
unhandled exception:org.appache.lucene.queryParser.ParseException | |||
|---|---|---|---|
| #18+ День добрый, TopDocs hits = searcher. search (searchQuery); Выдает ошибку : unhandled exception:org.appache.lucene.queryParser.ParseException Подскажите пожалуйста что бы это могло означать? import org.apache.lucene.document.Document; import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.TopDocs; import java.io.IOException; import java.text.ParseException; public class LuceneTester { String indexDir = "C:\\lucene\\Index"; String dataDir = "C:\\lucene\\Data"; Indexer indexer; Searcher searcher; public static void main(String[] args) { LuceneTester tester; try { tester = new LuceneTester(); tester.createIndex(); tester.search("333"); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } } private void createIndex() throws IOException { indexer = new Indexer(indexDir); int numIndexed; long startTime = System.currentTimeMillis(); numIndexed = indexer.createIndex(dataDir, new TextFileFilter()); long endTime = System.currentTimeMillis(); indexer.close(); System.out.println(numIndexed+" File indexed, time taken: " +(endTime-startTime)+" ms"); } private void search(String searchQuery) throws IOException, ParseException { searcher = new Searcher(indexDir); long startTime = System.currentTimeMillis(); TopDocs hits = searcher.search(searchQuery); long endTime = System.currentTimeMillis(); System.out.println(hits.totalHits + " documents found. Time :" + (endTime - startTime)); for(ScoreDoc scoreDoc : hits.scoreDocs) { Document doc = searcher.getDocument(scoreDoc); System.out.println("File: " + doc.get(LuceneConstants.FILE_PATH)); } searcher.close(); } } ... | |||
| : 
 Нравится:
     Не нравится:
     | |||
| 17.10.2019, 12:33 |  | ||
| 
unhandled exception:org.appache.lucene.queryParser.ParseException | |||
|---|---|---|---|
| #18+ Нашел, тема закрыта  package qonun1.TJ; import org.apache.lucene.document.Document; import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.TopDocs; import java.io.IOException; import java.text.ParseException; public class LuceneTester { String indexDir = "C:\\lucene\\Index"; String dataDir = "C:\\lucene\\Data"; Indexer indexer; Searcher searcher; public static void main(String[] args) { LuceneTester tester; try { tester = new LuceneTester(); tester.createIndex(); tester.search("test est st t ts tse tset"); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } catch (org.apache.lucene.queryParser.ParseException e) { e.printStackTrace(); } } private void createIndex() throws IOException { indexer = new Indexer(indexDir); int numIndexed; long startTime = System.currentTimeMillis(); numIndexed = indexer.createIndex(dataDir, new TextFileFilter()); long endTime = System.currentTimeMillis(); indexer.close(); System.out.println(numIndexed+" File indexed, time taken: " +(endTime-startTime)+" ms"); } private void search(String searchQuery) throws IOException, ParseException, org.apache.lucene.queryParser.ParseException { searcher = new Searcher(indexDir); long startTime = System.currentTimeMillis(); TopDocs hits = searcher.search(searchQuery); long endTime = System.currentTimeMillis(); System.out.println(hits.totalHits + " documents found. Time :" + (endTime - startTime)); for(ScoreDoc scoreDoc : hits.scoreDocs) { Document doc = searcher.getDocument(scoreDoc); System.out.println("File: " + doc.get(LuceneConstants.FILE_PATH)); } searcher.close(); } } ... | |||
| : 
 Нравится:
     Не нравится:
     | |||
| 17.10.2019, 14:43 |  | ||
|  | 

| start [/forum/topic.php?fid=59&fpage=22&tid=2121063]: | 0ms | 
| get settings: | 8ms | 
| get forum list: | 12ms | 
| check forum access: | 3ms | 
| check topic access: | 3ms | 
| track hit: | 45ms | 
| get topic data: | 10ms | 
| get forum data: | 2ms | 
| get page messages: | 34ms | 
| get tp. blocked users: | 1ms | 
| others: | 12ms | 
| total: | 130ms | 

| 0 / 0 | 
