You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Simon Willnauer <si...@googlemail.com> on 2009/06/12 15:11:05 UTC

Basic Queries are not pluggable

Hey there,

I have a had quite a couple of usecases where I had to change some
tiny things in basic queries like BooleanQuery. I subclassed those
queries and applied the change - no problem so far. But I wanted
lucene to use this modified query everywhere in other queries and (for
sure) in the query parser. The query parser integration was easy -
subclassed it and override new*Query() methods. The rest of lucene was
a nightmare and I eventually used a source distribution and changed it
in the actual implementation - don't comment this, I hate it!
I thought about this topic for a while and want to throw it out to the
list for discussion.

I would really appreciate to see some kind of factory methods used for
query construction for instance in the Query#rewrite() implementations
as well as in the QueryParser classes. Such a factory could be user
provided or by default simple call the constructor of the target
class. A patch for this would not break and backwards compat. afaik
and could help quite a couple of people out there I guess.

simon

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: Basic Queries are not pluggable

Posted by Michael McCandless <lu...@mikemccandless.com>.
+1

Mike

On Fri, Jun 12, 2009 at 9:11 AM, Simon
Willnauer<si...@googlemail.com> wrote:
> Hey there,
>
> I have a had quite a couple of usecases where I had to change some
> tiny things in basic queries like BooleanQuery. I subclassed those
> queries and applied the change - no problem so far. But I wanted
> lucene to use this modified query everywhere in other queries and (for
> sure) in the query parser. The query parser integration was easy -
> subclassed it and override new*Query() methods. The rest of lucene was
> a nightmare and I eventually used a source distribution and changed it
> in the actual implementation - don't comment this, I hate it!
> I thought about this topic for a while and want to throw it out to the
> list for discussion.
>
> I would really appreciate to see some kind of factory methods used for
> query construction for instance in the Query#rewrite() implementations
> as well as in the QueryParser classes. Such a factory could be user
> provided or by default simple call the constructor of the target
> class. A patch for this would not break and backwards compat. afaik
> and could help quite a couple of people out there I guess.
>
> simon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Fwd: Basic Queries are not pluggable

Posted by Simon Willnauer <si...@googlemail.com>.
I accidentally send this to Yonik directly -- forwarding to mail list.

On Fri, Jun 12, 2009 at 6:02 PM, Yonik Seeley<yo...@lucidimagination.com> wrote:
> Can something like AspectJ change the type of instantiated classes?
That is actually possible. An "around" advice and do that in a very
flexible way and I have thought of that before. Personally I would
prefer not to change the distributed jar file but rather plugging
something in from the outside. This might be a personal thing but I
can imagine that many users do not want to modify the binary
distribution using a aspectJ or whatever implementation compiler to
modify the bytecode.

simon
> -Yonik
> http://www.lucidimagination.com
>
>
>
> On Fri, Jun 12, 2009 at 9:11 AM, Simon
> Willnauer<si...@googlemail.com> wrote:
>> Hey there,
>>
>> I have a had quite a couple of usecases where I had to change some
>> tiny things in basic queries like BooleanQuery. I subclassed those
>> queries and applied the change - no problem so far. But I wanted
>> lucene to use this modified query everywhere in other queries and (for
>> sure) in the query parser. The query parser integration was easy -
>> subclassed it and override new*Query() methods. The rest of lucene was
>> a nightmare and I eventually used a source distribution and changed it
>> in the actual implementation - don't comment this, I hate it!
>> I thought about this topic for a while and want to throw it out to the
>> list for discussion.
>>
>> I would really appreciate to see some kind of factory methods used for
>> query construction for instance in the Query#rewrite() implementations
>> as well as in the QueryParser classes. Such a factory could be user
>> provided or by default simple call the constructor of the target
>> class. A patch for this would not break and backwards compat. afaik
>> and could help quite a couple of people out there I guess.
>>
>> simon
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: Basic Queries are not pluggable

Posted by Yonik Seeley <yo...@lucidimagination.com>.
Can something like AspectJ change the type of instantiated classes?

-Yonik
http://www.lucidimagination.com



On Fri, Jun 12, 2009 at 9:11 AM, Simon
Willnauer<si...@googlemail.com> wrote:
> Hey there,
>
> I have a had quite a couple of usecases where I had to change some
> tiny things in basic queries like BooleanQuery. I subclassed those
> queries and applied the change - no problem so far. But I wanted
> lucene to use this modified query everywhere in other queries and (for
> sure) in the query parser. The query parser integration was easy -
> subclassed it and override new*Query() methods. The rest of lucene was
> a nightmare and I eventually used a source distribution and changed it
> in the actual implementation - don't comment this, I hate it!
> I thought about this topic for a while and want to throw it out to the
> list for discussion.
>
> I would really appreciate to see some kind of factory methods used for
> query construction for instance in the Query#rewrite() implementations
> as well as in the QueryParser classes. Such a factory could be user
> provided or by default simple call the constructor of the target
> class. A patch for this would not break and backwards compat. afaik
> and could help quite a couple of people out there I guess.
>
> simon

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org