Please forgive my ignorance, but I am still quite the newbie to both Lucene and Solr. I was hoping to start by getting a simple example working in SOLR and then iterate towards the more complex, given this is my first attempt at extending Solr.
For my first iteration of SpanQuery in Solr I am thinking of starting with a simple syntax to combine: - SpanTermQuery - SpanNearQuery The logical syntax would be something like: TermQuery-1(term1 distance term2), TermQuery-2(term3 distance term4), SpanNearQuery-1 (TermQuery-1 distance TermQuery-2) Looks like I should look at the Xml-Query-Parser as a reference implementation on the Lucene side and the FooQParserPlugin as a reference implementation on the SOLR side? The other part of the riddle I would really appreciate some guidance on is how to get it to plug-in to SOLR correctly? Once I get the basics working then I will look into other features and a more expressive query syntax: - SpanOrQuery - SpanNotQuery - SpanFirstQuery - Qsol - as sentence and paragraph support will be nice. Appreciate any guidance, Christopher -----Original Message----- From: Yonik Seeley [mailto:yo...@lucidimagination.com] Sent: Wednesday, January 27, 2010 1:06 PM To: solr-user@lucene.apache.org Subject: Re: How to Implement SpanQuery in Solr . . ? As always, I'd try starting with what the user interface (in this case, syntax) should look like. It makes sense to add elementary spans first. {!spannear a=query1 b=query2 slop=10} Thinking about implementation... what would really magnify the usefulness of the basic API above is to convert non-span queries to span queries automatically. This is useful because the sub-queries of a span query must be span queries, and most query parsers generate non-span queries. I think there is code in the highlighter that uses spans that can do this conversion. -Yonik http://www.lucidimagination.com On Wed, Jan 27, 2010 at 12:24 PM, Christopher Ball <christopher.b...@metaheuristica.com> wrote: > I am about to attempt to implementing the SpanQuery in Solr 1.4. > > > > I noticed there is a JIRA to add it in 1.5: > > > > * https://issues.apache.org/jira/browse/SOLR-1337 > > > > I also noticed a couple of email threads from Grant and Yonik about trying > to implement it such as: > > > > * http://old.nabble.com/SpanQuery-support-td15246477.html > > > > So . . . > > > > * Question: Has anyone started working on SOLR-1337 for Solr 1.5? > > > > And if not . . . > > > > * Question: Is the best way to go about it is to follow the following > recipe? > > > > 1. Configure > > a. Specify a new parser plugin in solrconfig.xml: > > b. <queryParser name="mySpanQueryParser" > class="SpanQueryParserPlugin"/> > > 2. Implement > > a. Use the FooQParserPlugin as a starting template > (https://svn.apache.org/repos/asf/lucene/solr/trunk/src/test/org/apache/solr > /core/SOLR749Test.java) > > 3. Access > > a. Access the current query type via 'q=mySpanQueryParser ' > > > > Most grateful for any thoughts, > > > > Christopher > >