English 中文(简体)
为什么在使用莱叶时,我在Query parser留下错误
原标题:Why I keep getting error at Query parser when using lucene
  • 时间:2012-01-13 03:59:14
  •  标签:
  • java
  • lucene

Hello guys I am currently parsing all the html body for finding the document frequency of a list containing a words and why I keep getting this error

org.apache.lucene.queryParser.ParseException: Cannot parse   : Encountered "<EOF>" at line 1, column 0.

Was expecting one of: ... "+" ... "-" ... "(" ... "" ... ... ... ... ... "[" ... "{" ... ... ... "" ...

at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:211)
at CalculateWeightTable.search(CalculateWeightTable.java:221)
at CalculateWeightTable.calculate(CalculateWeightTable.java:134)
at FocusedCrawlingMain.Search(FocusedCrawlingMain.java:64)
at View.actionPerformed(View.java:219)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

这是我发现文件频率的守则。

并且说,错误是当Lucene试图平息争 que的时候。

页: 1

Query query = parser.parse(queryString);

我很想知道,为什么在平息争 the时让我有错误。

private static int search(Searcher searcher, String queryString)
        throws ParseException, IOException {

    // Build a Query object
    StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, "content",
            analyzer);
    Query query = parser.parse(queryString);

    // Search for the query
    TopScoreDocCollector collector = TopScoreDocCollector.create(10, true);
    searcher.search(query, collector);

    ScoreDoc[] hit = collector.topDocs().scoreDocs;

    int hitsCount = hit.length;

    if (hitsCount == 0) {
        //System.out.println("No matches were found for "" + queryString+ """);
    } else {
        //System.out.println("hit count : " + collector.getTotalHits());

    }

    return collector.getTotalHits();
}
最佳回答

看像问话题一样是空的。 您可以从援引这一方法的角度检查对这种方法的投入。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签