Discussion:
How to use javacc with QueryParser.jj
Nawab Zada Asad Iqbal
2017-07-24 14:31:38 UTC
Permalink
[Subject changed for reposting]

Good morning,

If I want to change something in the lucene-solr/solr/core/src/java
/org/apache/solr/parser/QueryParser.jj, what is the workflow to generate
the new Java code?


Thanks
Nawab
ok, I see there is an `ant javacc` target in some folders, e.g.
1) lucene-solr/solr/build/solr/src-export/solr/core
2) lucene-solr/lucene/queryparser
Both of them use different parser files. I am interested in the
lucene-solr/solr/core/src/java/org/apache/solr/parser/QueryParser.jj
this apparently is getting dropped at: lucene-solr/solr/build/solr/sr
c-export/solr/core/src/java/org/apache/solr/parser/QueryParser.jj
However, I am not sure what target drops it!
Nawab
Hi,
I know that we can make changes in the language by editing
QueryParser.jj, however, how does it get generated into java code? Is there
any ant target?
'compile' doesn't seem to generate java code for my changes (e.g., adding
lower case logical operators).
Regards
Nawab
Nawab Zada Asad Iqbal
2017-07-24 15:07:02 UTC
Permalink
I guess, I finally found the answer here:

http://codegouge.blogspot.com/2014/01/modifying-solr-queryparser.html

"
If you're doing development in Solr trunk and want to adjust the
QueryParser, take a look at the JavaCC grammar file
<https://javacc.java.net/doc/javaccgrm.html> at
lucene/solr/core/src/java/org/apache/solr/parser/QueryParser.jj. This
isn't a tutorial about JavaCC - there are plenty of those out there
<http://cs.lmu.edu/%7Eray/notes/javacc/>.

Once your changes are complete, you'll need to generate the underlying
classes again. ant builds from lucene/ or lucene/solr/ don't accomplish
this. So to do this, run 'ant javacc' from lucene/solr/core/.

That's it.
"
Post by Nawab Zada Asad Iqbal
[Subject changed for reposting]
Good morning,
If I want to change something in the lucene-solr/solr/core/src/java
/org/apache/solr/parser/QueryParser.jj, what is the workflow to generate
the new Java code?
Thanks
Nawab
ok, I see there is an `ant javacc` target in some folders, e.g.
1) lucene-solr/solr/build/solr/src-export/solr/core
2) lucene-solr/lucene/queryparser
Both of them use different parser files. I am interested in the
lucene-solr/solr/core/src/java/org/apache/solr/parser/QueryParser.jj
this apparently is getting dropped at: lucene-solr/solr/build/solr/sr
c-export/solr/core/src/java/org/apache/solr/parser/QueryParser.jj
However, I am not sure what target drops it!
Nawab
Hi,
I know that we can make changes in the language by editing
QueryParser.jj, however, how does it get generated into java code? Is there
any ant target?
'compile' doesn't seem to generate java code for my changes (e.g.,
adding lower case logical operators).
Regards
Nawab
Loading...