Search code examples
javascriptlucenesyntax-highlightinggoogle-code-prettify

Google prettify language for boolean queries


I am trying to "pretty print" boolean queries using google-code-prettify. Specifially queries that will be parsed by the StandardQueryParser in lucene.

So far I have been playing around, trying to define a new language definition by modifying the existing lang-sql.js file. Unfortunately I cannot find any documentation to help me in this process, and I'm terrible at regular expressions, so it's not going that well.

I am therefore wondering if anyone can help me out with the following:

  1. Are there any pre-existing language definitions for boolean and/or lucene queries?
  2. If not, is there any documentation or any resources on the web that can help me write custom language definitions for google-code-prettify?
  3. Are there any other alternatives to google-code-prettify that supports these types of boolean queries out of the box?

Any help would be greatly appreciated.


Solution

  • I ended up using Hightlight.js instead of google-code-prettify. I was able to make a simple syntax for highlighting Lucene queries in a way that fits my requirements.

    Hightlight.js has decent development documentation, and the source code, cloned from git repository, comes with build script (in python) and easy to use tools for testing styles and language definitions.