Re: ValueSourceParser problem

2009-12-15 Thread Shalin Shekhar Mangar
On Wed, Dec 16, 2009 at 12:39 PM, patrick o'leary  wrote:

> Yeah.. can't release that part mate, all you need is
>
> package com.pjaol;
>
> import org.apache.lucene.queryParser.ParseException;
> import org.apache.solr.search.FunctionQParser;
> import org.apache.solr.search.ValueSourceParser;
> import org.apache.solr.search.function.ValueSource;
>
> public class CustomValueSourceParser extends ValueSourceParser{
>
>@Override
>public ValueSource parse(FunctionQParser fp) throws ParseException {
>
>System.out.println("*** Called");
>return null;
>}
>
> }
>
>
> And
>  class="com.pjaol.CustomValueSourceParser"
> />
> in your solrconfig.xml
>
> The parse method only gets called at query time
>
>
Patrick, this works for me. The string is printed in the console. Your
runtime classpath must have Solr 1.3 jars somewhere because the
ValueSourceParser#init was abstract in 1.3

http://svn.apache.org/repos/asf/lucene/solr/branches/branch-1.3/src/java/org/apache/solr/search/ValueSourceParser.java

-- 
Regards,
Shalin Shekhar Mangar.


Re: ValueSourceParser problem

2009-12-15 Thread patrick o'leary
Yeah.. can't release that part mate, all you need is

package com.pjaol;

import org.apache.lucene.queryParser.ParseException;
import org.apache.solr.search.FunctionQParser;
import org.apache.solr.search.ValueSourceParser;
import org.apache.solr.search.function.ValueSource;

public class CustomValueSourceParser extends ValueSourceParser{

@Override
public ValueSource parse(FunctionQParser fp) throws ParseException {

System.out.println("*** Called");
return null;
}

}


And

in your solrconfig.xml

The parse method only gets called at query time

2009/12/15 Noble Paul നോബിള്‍ नोब्ळ् 

> it does not have the code for SocialValueSource..
>
> On Wed, Dec 16, 2009 at 12:18 PM, patrick o'leary  wrote:
> > Rather than subject the list to code, it's pasted here
> > http://www.pasteyourcode.com/13969
> >
> >
> > On Tue, Dec 15, 2009 at 10:42 PM, Shalin Shekhar Mangar <
> > shalinman...@gmail.com> wrote:
> >
> >> On Wed, Dec 16, 2009 at 11:58 AM, patrick o'leary 
> wrote:
> >>
> >> > SEVERE: java.lang.AbstractMethodError
> >> >at
> org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:439)
> >> >at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1498)
> >> >at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1492)
> >> >at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1525)
> >> >at
> >> >
> org.apache.solr.core.SolrCore.initValueSourceParsers(SolrCore.java:1469)
> >> >at org.apache.solr.core.SolrCore.(SolrCore.java:549)
> >> >at
> >> >
> >> >
> >>
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137)
> >> >at
> >> >
> >>
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
> >> >at
> >> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
> >> >
> >> > And
> >> > svn info
> >> > Path: .
> >> > URL: http://svn.apache.org/repos/asf/lucene/solr/trunk
> >> > Repository Root: http://svn.apache.org/repos/asf
> >> > Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
> >> > Revision: 891117
> >> > Node Kind: directory
> >> > Schedule: normal
> >> > Last Changed Author: koji
> >> > Last Changed Rev: 890798
> >> > Last Changed Date: 2009-12-15 06:13:59 -0800 (Tue, 15 Dec 2009)
> >> >
> >> >
> >> I just wrote a custom ValueSourceParser which does not override the init
> >> method and it loads fine on current trunk. Can you share your code?
> >>
> >> --
> >> Regards,
> >> Shalin Shekhar Mangar.
> >>
> >
>
>
>
> --
> -
> Noble Paul | Systems Architect| AOL | http://aol.com
>


Re: ValueSourceParser problem

2009-12-15 Thread Noble Paul നോബിള്‍ नोब्ळ्
it does not have the code for SocialValueSource..

On Wed, Dec 16, 2009 at 12:18 PM, patrick o'leary  wrote:
> Rather than subject the list to code, it's pasted here
> http://www.pasteyourcode.com/13969
>
>
> On Tue, Dec 15, 2009 at 10:42 PM, Shalin Shekhar Mangar <
> shalinman...@gmail.com> wrote:
>
>> On Wed, Dec 16, 2009 at 11:58 AM, patrick o'leary  wrote:
>>
>> > SEVERE: java.lang.AbstractMethodError
>> >    at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:439)
>> >    at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1498)
>> >    at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1492)
>> >    at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1525)
>> >    at
>> > org.apache.solr.core.SolrCore.initValueSourceParsers(SolrCore.java:1469)
>> >    at org.apache.solr.core.SolrCore.(SolrCore.java:549)
>> >    at
>> >
>> >
>> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137)
>> >    at
>> >
>> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
>> >    at
>> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
>> >
>> > And
>> > svn info
>> > Path: .
>> > URL: http://svn.apache.org/repos/asf/lucene/solr/trunk
>> > Repository Root: http://svn.apache.org/repos/asf
>> > Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
>> > Revision: 891117
>> > Node Kind: directory
>> > Schedule: normal
>> > Last Changed Author: koji
>> > Last Changed Rev: 890798
>> > Last Changed Date: 2009-12-15 06:13:59 -0800 (Tue, 15 Dec 2009)
>> >
>> >
>> I just wrote a custom ValueSourceParser which does not override the init
>> method and it loads fine on current trunk. Can you share your code?
>>
>> --
>> Regards,
>> Shalin Shekhar Mangar.
>>
>



-- 
-
Noble Paul | Systems Architect| AOL | http://aol.com


Re: ValueSourceParser problem

2009-12-15 Thread patrick o'leary
Rather than subject the list to code, it's pasted here
http://www.pasteyourcode.com/13969


On Tue, Dec 15, 2009 at 10:42 PM, Shalin Shekhar Mangar <
shalinman...@gmail.com> wrote:

> On Wed, Dec 16, 2009 at 11:58 AM, patrick o'leary  wrote:
>
> > SEVERE: java.lang.AbstractMethodError
> >at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:439)
> >at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1498)
> >at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1492)
> >at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1525)
> >at
> > org.apache.solr.core.SolrCore.initValueSourceParsers(SolrCore.java:1469)
> >at org.apache.solr.core.SolrCore.(SolrCore.java:549)
> >at
> >
> >
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137)
> >at
> >
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
> >at
> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
> >
> > And
> > svn info
> > Path: .
> > URL: http://svn.apache.org/repos/asf/lucene/solr/trunk
> > Repository Root: http://svn.apache.org/repos/asf
> > Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
> > Revision: 891117
> > Node Kind: directory
> > Schedule: normal
> > Last Changed Author: koji
> > Last Changed Rev: 890798
> > Last Changed Date: 2009-12-15 06:13:59 -0800 (Tue, 15 Dec 2009)
> >
> >
> I just wrote a custom ValueSourceParser which does not override the init
> method and it loads fine on current trunk. Can you share your code?
>
> --
> Regards,
> Shalin Shekhar Mangar.
>


Re: ValueSourceParser problem

2009-12-15 Thread Shalin Shekhar Mangar
On Wed, Dec 16, 2009 at 11:58 AM, patrick o'leary  wrote:

> SEVERE: java.lang.AbstractMethodError
>at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:439)
>at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1498)
>at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1492)
>at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1525)
>at
> org.apache.solr.core.SolrCore.initValueSourceParsers(SolrCore.java:1469)
>at org.apache.solr.core.SolrCore.(SolrCore.java:549)
>at
>
> org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137)
>at
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
>at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
>
> And
> svn info
> Path: .
> URL: http://svn.apache.org/repos/asf/lucene/solr/trunk
> Repository Root: http://svn.apache.org/repos/asf
> Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
> Revision: 891117
> Node Kind: directory
> Schedule: normal
> Last Changed Author: koji
> Last Changed Rev: 890798
> Last Changed Date: 2009-12-15 06:13:59 -0800 (Tue, 15 Dec 2009)
>
>
I just wrote a custom ValueSourceParser which does not override the init
method and it loads fine on current trunk. Can you share your code?

-- 
Regards,
Shalin Shekhar Mangar.


Re: ValueSourceParser problem

2009-12-15 Thread patrick o'leary
SEVERE: java.lang.AbstractMethodError
at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:439)
at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1498)
at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1492)
at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1525)
at
org.apache.solr.core.SolrCore.initValueSourceParsers(SolrCore.java:1469)
at org.apache.solr.core.SolrCore.(SolrCore.java:549)
at
org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137)
at
org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)

And
svn info
Path: .
URL: http://svn.apache.org/repos/asf/lucene/solr/trunk
Repository Root: http://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 891117
Node Kind: directory
Schedule: normal
Last Changed Author: koji
Last Changed Rev: 890798
Last Changed Date: 2009-12-15 06:13:59 -0800 (Tue, 15 Dec 2009)


On Tue, Dec 15, 2009 at 10:12 PM, Shalin Shekhar Mangar <
shalinman...@gmail.com> wrote:

> On Wed, Dec 16, 2009 at 11:32 AM, patrick o'leary  wrote:
>
> > Check SolrCore.createInitInstance
> > It cast's your CustomValueSourceParser as a NamedListInitializedPlugin
> > which
> > is an interface,
> > thus the AbstractMethodError, as there isn't a concrete implementation of
> > init.
> >
> > If it cast it as a ValueSourceParser in SolrCore then it would be fine.
> >
> >
> That is not possible. Even though the object is cast to an interface
> NamedListInitializedPlugin, it is still an instance of ValueSourceParser
> and
> therefore it does have an implementation of the init method. Am I missing
> something?
>
> --
> Regards,
> Shalin Shekhar Mangar.
>


Re: ValueSourceParser problem

2009-12-15 Thread Shalin Shekhar Mangar
On Wed, Dec 16, 2009 at 11:32 AM, patrick o'leary  wrote:

> Check SolrCore.createInitInstance
> It cast's your CustomValueSourceParser as a NamedListInitializedPlugin
> which
> is an interface,
> thus the AbstractMethodError, as there isn't a concrete implementation of
> init.
>
> If it cast it as a ValueSourceParser in SolrCore then it would be fine.
>
>
That is not possible. Even though the object is cast to an interface
NamedListInitializedPlugin, it is still an instance of ValueSourceParser and
therefore it does have an implementation of the init method. Am I missing
something?

-- 
Regards,
Shalin Shekhar Mangar.


Re: ValueSourceParser problem

2009-12-15 Thread patrick o'leary
Check SolrCore.createInitInstance
It cast's your CustomValueSourceParser as a NamedListInitializedPlugin which
is an interface,
thus the AbstractMethodError, as there isn't a concrete implementation of
init.

If it cast it as a ValueSourceParser in SolrCore then it would be fine.

On Tue, Dec 15, 2009 at 9:59 PM, Shalin Shekhar Mangar <
shalinman...@gmail.com> wrote:

> On Wed, Dec 16, 2009 at 11:01 AM, patrick o'leary  wrote:
>
> >
> > #2 There's an AbstractMethodError when you extend ValueSourceParser and
> > don't override the init(NamedList args) method
> > because SolrCore:~439 createInitInstance, cast's the plugin class as a
> > NamedListInitializedPlugin, and call's
> > ((NamedListInitializedPlugin) o).init(info.initArgs);
> >
> > If your extended ValueSourceParser class doesn't provide an override,
> then
> > there's nothing that implements the base interface from
> > NamedListInitializedPlugin.
> >
> >
> ValueSourceParser in trunk has an empty init method so you should never get
> a AbstractMethodError. Can you check again?
>
> --
> Regards,
> Shalin Shekhar Mangar.
>


Re: ValueSourceParser problem

2009-12-15 Thread Shalin Shekhar Mangar
On Wed, Dec 16, 2009 at 11:01 AM, patrick o'leary  wrote:

>
> #2 There's an AbstractMethodError when you extend ValueSourceParser and
> don't override the init(NamedList args) method
> because SolrCore:~439 createInitInstance, cast's the plugin class as a
> NamedListInitializedPlugin, and call's
> ((NamedListInitializedPlugin) o).init(info.initArgs);
>
> If your extended ValueSourceParser class doesn't provide an override, then
> there's nothing that implements the base interface from
> NamedListInitializedPlugin.
>
>
ValueSourceParser in trunk has an empty init method so you should never get
a AbstractMethodError. Can you check again?

-- 
Regards,
Shalin Shekhar Mangar.


Re: ValueSourceParser problem

2009-12-15 Thread Mattmann, Chris A (388J)
Hey Patrick,

On 12/15/09 9:31 PM, "patrick o'leary"  wrote:

> #1 Change documentation of
> http://wiki.apache.org/solr/SolrPlugins#ValueSourceParser to say extends
> ValueSourceParser rather than implements.

I updated the Wiki based on your comment.

Cheers,
Chris

++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: chris.mattm...@jpl.nasa.gov
WWW:   http://sunset.usc.edu/~mattmann/
++
Adjunct Assistant Professor, Computer Science Department University of
Southern California, Los Angeles, CA 90089 USA
++




ValueSourceParser problem

2009-12-15 Thread patrick o'leary
Howdy

Couple of things about the ValueSourceParser

#1 Change documentation of
http://wiki.apache.org/solr/SolrPlugins#ValueSourceParser to say extends
ValueSourceParser rather than implements.

#2 There's an AbstractMethodError when you extend ValueSourceParser and
don't override the init(NamedList args) method
because SolrCore:~439 createInitInstance, cast's the plugin class as a
NamedListInitializedPlugin, and call's
((NamedListInitializedPlugin) o).init(info.initArgs);

If your extended ValueSourceParser class doesn't provide an override, then
there's nothing that implements the base interface from
NamedListInitializedPlugin.

Providing a head scratching conundrum that should be avoided.

Seems more than a documentation fix

Patrick