|  | 
| 
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/search_topic.php?author=Axioma99&author_mode=last_posts&do_search=1]: | 0ms | 
| get settings: | 9ms | 
| get forum list: | 13ms | 
| get settings: | 9ms | 
| get forum list: | 11ms | 
| check forum access: | 4ms | 
| check topic access: | 4ms | 
| track hit: | 34ms | 
| get topic data: | 10ms | 
| get forum data: | 2ms | 
| get page messages: | 40ms | 
| get tp. blocked users: | 1ms | 
| others: | 444ms | 
| total: | 581ms | 

| 0 / 0 | 
