Depending on your needs, you might want to take a look at my SpanQueryParser 
(LUCENE-5205/SOLR-5410).  It does not offer dtsearch syntax, but if the 
SurroundQueryParser was close enough, this parser may be of use.  If you need 
modifications to it, let me know.  I'm in the process of adding 
SpanPositionRangeQuery syntax.

If you need to roll your own, beware, it is not a trivial task.  The 
SimpleQueryParser might offer the cleanest example to build on top of.

Working versions of LUCENE-5205/SpanQueryParser are available on my github 
site.  If you are using Lucene/Solr 5.5, for example, go to this branch:

https://github.com/tballison/lucene-addons/tree/lucene5.5-0.1



-----Original Message-----


From: Charlie Hull [mailto:char...@flax.co.uk] 
Sent: Friday, May 13, 2016 5:41 AM
To: solr-user@lucene.apache.org
Subject: Re: dtSearch parser & Introduction

On 12/05/2016 23:50, Brandon Miller wrote:
> Hello, all!  I'm a BloombergBNA employee and need to obtain/write a 
> dtSearch parser for solr (and probably a bunch of other things a 
> little later).
> I've looked at the available parsers and thought that the surround 
> parser may do the trick, but it apparently doesn't like nested N or W 
> subqueries.
> I looked at XmlQueryParser and I'm most impressed with it from a 
> functionality perspective.  I liked the SpanQueries, but I either 
> don't understand SpanNot or it has a bug for the exclude.
> At the end of the day, we will need to continue to support dtSearch 
> syntax.  I may as well just bite the bullet and write the dtSearch 
> parser and include it as a patch for Solr.

Hi Brandon,

We have a version of a dtSearch/Lucene query parser written a few years
ago: 
http://www.flax.co.uk/blog/2012/04/24/dtsolr-an-open-source-replacement-for-the-dtsearch-closed-source-search-engine/

It would need some work to bring it up to date with the latest version of Solr 
(which is why we're not offering it for download any more), but it would save 
you a lot of time. We've also built parsers for Verity's query language and 
some others - just so you're warned, writing parsers isn't an easy task for a 
beginner, often to support what looks like a simple query in your old language 
can involve some quite complex work on the Lucene side.

Best

Charlie

>
> Here are my immediate issues:
>    - I don't know the best path forward on making the parser (I saw 
> something in the HowToContribute page at the bottom about JFlex)  -  
> Can someone please take pity on me and help me get started down this 
> path?  I probably won't need a lot of help.
>    - I'm great at .NET, not so much Java--yet.  I've not yet been able 
> to build a trunk and "deploy" it (I can build it and run tests, but 
> not run it--I'm sure I'm just missing an elusive documentation link on 
> how to do
> that)
>    - I downloaded and got the solr trunk in Eclipse.  I'm not sure the 
> best way of adding unit tests for my stuff--do I add it to an existing 
> subdirectory or create a new package?
>
> I think it'd be great if I could get a bare-bones example of a parser 
> so that I can modify it--perhaps even keeping it in a separate Java project.
>
> Don't feel like you have to answer all of my questions--an answer to 
> any of them would be quite helpful.
>
> Thank you guys and God bless!
>


--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk

Reply via email to