powered by simpleCommunicator - 2.0.49     © 2025 Programmizd 02
Форумы / Java [игнор отключен] [закрыт для гостей] / unhandled exception:org.appache.lucene.queryParser.ParseException
2 сообщений из 2, страница 1 из 1
unhandled exception:org.appache.lucene.queryParser.ParseException
    #39877626
Zafar Z
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
День добрый,

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();
}
}
...
Рейтинг: 0 / 0
unhandled exception:org.appache.lucene.queryParser.ParseException
    #39877730
Zafar Z
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Нашел, тема закрыта

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();
}
}
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / unhandled exception:org.appache.lucene.queryParser.ParseException
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]