user7310905
user7310905

Reputation:

Cannot resolve symbol QueryParser Lucene 7.5

When writing the following code:

QueryParser qp = new QueryParser("id", new StandardAnalyzer());,

IntelliJ IDEA gives me the error: Cannot resolve symbol 'QueryParser'.

I've also explicitly imported the following library

import org.apache.lucene.queryparser.classic.QueryParser;,

but this also gives me the following error: Cannot resolve symbol 'queryparser'.

I am using Lucene 7.5, and added the .jar file from core directory to

Project Structure -> Modules -> Dependencies -> + Sign -> JARs or Directories and add Lucene .jar file.

Upvotes: 1

Views: 780

Answers (1)

Andrew Janke
Andrew Janke

Reputation: 23858

Lucene ships with several JARs. Did you include lucene-queryparser-7.5.0.jar in addition to lucene-core-7.5.0.jar? It's in the queryparser/ directory next to the core/ directory. Add that one too and it should resolve.

Upvotes: 1

Related Questions