You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Yonik Seeley <yo...@lucidimagination.com> on 2009/06/15 23:47:29 UTC

createWeight protected

I'm simply trying to create a query wrapper class to hold some
additional metadata, and delegate all operations to the wrapped query.
Something as simple as that.... can't do it because of java
permissions (outside of lucene).

  protected Weight createWeight(Searcher searcher) throws IOException {
    return q.createWeight(searcher);  // we could call
super.createWeight() but not q.createWeight() !
  }

createWeight seems somewhat expert-level, but not overly so, and it
does seem like it should be public instead of projected.
Thoughts?

-Yonik
http://www.lucidimagination.com

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


Re: createWeight protected

Posted by Simon Willnauer <si...@googlemail.com>.
+1
it''s a kind of a factory method anyway no need to be protected.


On Mon, Jun 15, 2009 at 11:47 PM, Yonik
Seeley<yo...@lucidimagination.com> wrote:
> I'm simply trying to create a query wrapper class to hold some
> additional metadata, and delegate all operations to the wrapped query.
> Something as simple as that.... can't do it because of java
> permissions (outside of lucene).
>
>  protected Weight createWeight(Searcher searcher) throws IOException {
>    return q.createWeight(searcher);  // we could call
> super.createWeight() but not q.createWeight() !
>  }
>
> createWeight seems somewhat expert-level, but not overly so, and it
> does seem like it should be public instead of projected.
> Thoughts?
>
> -Yonik
> http://www.lucidimagination.com
>
> ---------------------------------------------------------------------
> 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


Re: createWeight protected

Posted by Shai Erera <se...@gmail.com>.
yes it is. just needs a volunteer to help me commit the patch.

On Tue, Jun 16, 2009 at 6:15 AM, Yonik Seeley <yo...@lucidimagination.com>wrote:

> On Mon, Jun 15, 2009 at 10:53 PM, Shai Erera<se...@gmail.com> wrote:
> > But note that Query has weight() and createWeight(), which I am still
> > confused about why we have two of them. Maybe I can consolidate them to
> one?
>
> createWeight() raw weight, and weight() is a top-level normalized weight.
> I don't think they should be consolidated, but good JavaDoc is needed.
>
> But the fact that "weight" is also a non-static public member is
> further evidence that createWeight() needs to be public (how else
> would one provide a different implementation?)
>
> > Anyway, I think this better be handled as part of LUCENE-1630, since the
> > Query and Weight classes are touched already in that are exactly.
>
> If it's going to make it into 2.9, that's fine.
>
> -Yonik
> http://www.lucidimagination.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

Re: createWeight protected

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Mon, Jun 15, 2009 at 10:53 PM, Shai Erera<se...@gmail.com> wrote:
> But note that Query has weight() and createWeight(), which I am still
> confused about why we have two of them. Maybe I can consolidate them to one?

createWeight() raw weight, and weight() is a top-level normalized weight.
I don't think they should be consolidated, but good JavaDoc is needed.

But the fact that "weight" is also a non-static public member is
further evidence that createWeight() needs to be public (how else
would one provide a different implementation?)

> Anyway, I think this better be handled as part of LUCENE-1630, since the
> Query and Weight classes are touched already in that are exactly.

If it's going to make it into 2.9, that's fine.

-Yonik
http://www.lucidimagination.com

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


Re: createWeight protected

Posted by Shai Erera <se...@gmail.com>.
In LUCENE-1630 I've deprecated createWeight in favor of a new
createQueryWeight, also protected. So I can change the new one to public.

But note that Query has weight() and createWeight(), which I am still
confused about why we have two of them. Maybe I can consolidate them to one?

Anyway, I think this better be handled as part of LUCENE-1630, since the
Query and Weight classes are touched already in that are exactly.

Shai

On Tue, Jun 16, 2009 at 1:35 AM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> +1
>
> Mike
>
> On Mon, Jun 15, 2009 at 5:47 PM, Yonik Seeley<yo...@lucidimagination.com>
> wrote:
> > I'm simply trying to create a query wrapper class to hold some
> > additional metadata, and delegate all operations to the wrapped query.
> > Something as simple as that.... can't do it because of java
> > permissions (outside of lucene).
> >
> >  protected Weight createWeight(Searcher searcher) throws IOException {
> >    return q.createWeight(searcher);  // we could call
> > super.createWeight() but not q.createWeight() !
> >  }
> >
> > createWeight seems somewhat expert-level, but not overly so, and it
> > does seem like it should be public instead of projected.
> > Thoughts?
> >
> > -Yonik
> > http://www.lucidimagination.com
> >
> > ---------------------------------------------------------------------
> > 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
>
>

Re: createWeight protected

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

Mike

On Mon, Jun 15, 2009 at 5:47 PM, Yonik Seeley<yo...@lucidimagination.com> wrote:
> I'm simply trying to create a query wrapper class to hold some
> additional metadata, and delegate all operations to the wrapped query.
> Something as simple as that.... can't do it because of java
> permissions (outside of lucene).
>
>  protected Weight createWeight(Searcher searcher) throws IOException {
>    return q.createWeight(searcher);  // we could call
> super.createWeight() but not q.createWeight() !
>  }
>
> createWeight seems somewhat expert-level, but not overly so, and it
> does seem like it should be public instead of projected.
> Thoughts?
>
> -Yonik
> http://www.lucidimagination.com
>
> ---------------------------------------------------------------------
> 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