You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by rajini maski <ra...@gmail.com> on 2011/04/22 09:00:51 UTC

Query regarding solr plugin.

One doubt regarding adding the solr plugin.


          I have a new java file created that includes few changes in
SynonymFilterFactory.java. I want this java file to be added to solr
instance.

I created a package as : org.apache.pco.search
This includes OrcSynonymFilterFactory java class extends
BaseTokenFilterFactory implements ResourceLoaderAware {code.....}

Packages included: import org.apache.solr.analysis.*;

import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.solr.common.ResourceLoader;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.util.plugin.ResourceLoaderAware;

import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;


 I exported this java file in eclipse,
 selecting  File tab-Export to package
-org.apache.pco.search-OrchSynonymFilterFactory.java
 and generated jar file - org.apache.pco.orchSynonymFilterFactory.jar

 This jar file placed in /lib folder of solr home instance
 Changes in solr config - <lib dir="./lib" />

 Now i want to add this in schema fieldtype for synonym filter as

<filter class="org.apache.pco.search.orchSynonymFilterFactory"
synonyms="synonyms.txt" ignoreCase="true" expand="true"/>

But i am not able to do it.." It has an error
as org.apache.solr.common.SolrException: Error loading class
'pointcross.orchSynonymFilterFactory' at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
at
org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
at org.apache.solr.util.plugin.AbstractPluginLoader"

Please can anyone tell me , What is the mistake i am doing here and the fix
for it ?

Rajani

Re: Query regarding solr plugin.

Posted by rajini maski <ra...@gmail.com>.
Erick,

Thank you. I could fix the problem. Started from scratch considering your
advice and been successful. Thanks a lot.

Rajani Maski


On Tue, Apr 26, 2011 at 5:28 PM, Erick Erickson <er...@gmail.com>wrote:

> Sorry, but there's too much here to debug remotely. I strongly advise you
> back waaaay up. Undo (but save) all your changes. Start by doing
> the simplest thing you can, just get a dummy class in place and
> get it called. Perhaps create a really dumb logger method that
> opens a text file, writes a message, and closes the file. Inefficient
> I know, but this is just to find out the problem. Debugging by println is
> an ancient technique...
>
> Once you're certain the dummy class is called, gradually build it up
> to the complex class you eventually want.
>
> One problem here is that you've changed a bunch of moving parts, copied
> jars around (it's unclear whether you have two copies of solr-core in your
> classpath, for instance). So knowing exactly which one of those is the
> issue
> is very difficult, especially since you may have forgotten one of the
> things
> you did. I know when I've been trying to do something for days, lots of
> details get lost.
>
> Try to avoid changing the underlying Solr code, can you do what you want
> by subclassing instead and calling your new class? That would avoid
> a bunch of problems.  If you can't subclass, copy the whole thing and
> rename it to something new and call *that* rather than re-use the
> synonymfilterfactory. The only jar you should copy to the <lib> directory
> would be the one you put your new class in.
>
> I can't emphasize strongly enough that you'll save yourself lots of grief
> if
> you start with a fresh install and build up gradually rather than try to
> unravel the current code. It feels wasteful, but winds up being faster in
> my experience...
>
> Good Luck!
> Erick
>
> On Tue, Apr 26, 2011 at 12:41 AM, rajini maski <ra...@gmail.com>
> wrote:
> > Thanks Erick. I have added my replies to the points you did mention. I am
> > somewhere going wrong. I guess do I need to club both the jars or
> something
> > ? If yes, how do i do that? I have no much idea about java and jar files.
> > Please guide me here.
> >
> > A couple of things to try.
> >
> > 1> when you do a 'jar -tfv <yourjar>", you should see
> > output like:
> >  1183 Sun Jun 06 01:31:14 EDT 2010
> > org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
> > and your <filter> statement may need the whole path, in this example...
> > <filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../>
> (note,
> > this
> > is just an example of the pathing, this class has nothing to do with
> > your filter)...
> >
> > I could see this output..
> >
> > 2> But I'm guessing your path is actually OK, because I'd expect to be
> > seeing a
> > "class not found" error. So my guess is that your class depends on
> > other jars that
> > aren't packaged up in your jar and if you find which ones they are and
> copy
> > them
> > to your lib directory you'll be OK. Or your code is throwing an error
> > on load. Or
> > something like that...
> >
> > There is jar - "apache-solr-core-1.4.1.jar" this has the
> > BaseTokenFilterFacotry class and the Synonymfilterfactory class..I made
> the
> > changes in second class file and created it as new. Now i created a jar
> of
> > that java file and placed this in solr home/lib and also placed
> > "apache-solr-core-1.4.1.jar" file in lib folder of solr home.  [solr home
> -
> > c:\orch\search\solr  lib path - c:\orch\search\solr\lib]
> >
> > 3> to try to understand what's up, I'd back up a step. Make a really
> > stupid class
> > that doesn't do anything except derive from BaseTokenFilterFacotry and
> see
> > if
> > you can load that. If you can, then your process is OK and you need to
> > find out what classes your new filter depend on. If you still can't, then
> we
> > can
> > see what else we can come up with..
> >
> >
> > I am perhaps doing same. In the synonymfilterfactory class, there is a
> > function parse rules which takes delimiters as one of the input
> parameter.
> > Here i changed  comma ',' to '~' tilde symbol and  thats it.
> >
> >
> > Regards,
> > Rajani
> >
> >
> > On Mon, Apr 25, 2011 at 6:26 PM, Erick Erickson <erickerickson@gmail.com
> >wrote:
> >
> >> Looking at things more carefully, it may be one of your dependent
> classes
> >> that's not being found.
> >>
> >> A couple of things to try.
> >>
> >> 1> when you do a 'jar -tfv <yourjar>", you should see
> >> output like:
> >>  1183 Sun Jun 06 01:31:14 EDT 2010
> >> org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
> >> and your <filter> statement may need the whole path, in this example...
> >> <filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../>
> (note,
> >> this
> >> is just an example of the pathing, this class has nothing to do with
> >> your filter)...
> >>
> >> 2> But I'm guessing your path is actually OK, because I'd expect to be
> >> seeing a
> >> "class not found" error. So my guess is that your class depends on
> >> other jars that
> >> aren't packaged up in your jar and if you find which ones they are and
> copy
> >> them
> >> to your lib directory you'll be OK. Or your code is throwing an error
> >> on load. Or
> >> something like that...
> >>
> >> 3> to try to understand what's up, I'd back up a step. Make a really
> >> stupid class
> >> that doesn't do anything except derive from BaseTokenFilterFacotry and
> see
> >> if
> >> you can load that. If you can, then your process is OK and you need to
> >> find out what classes your new filter depend on. If you still can't,
> then
> >> we can
> >> see what else we can come up with..
> >>
> >> Best
> >> Erick
> >>
> >> On Mon, Apr 25, 2011 at 2:34 AM, rajini maski <ra...@gmail.com>
> >> wrote:
> >> > Erick ,
> >> > *
> >> > *
> >> > * Thanks.* It was actually a copy mistake. Anyways i did a redo of all
> >> the
> >> > below mentioned steps. I had given class name as
> >> > <filter class="pointcross.orchSynonymFilterFactory"
> >> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >> >
> >> > I did it again now following few different steps following this link :
> >> >
> >>
> http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-32.htm
> >> >
> >> >
> >> > 1 ) Created new package in src folder .
> >> *org.apache.pointcross.synonym*.This
> >> > is having class Synonym.java
> >> >
> >> > 2) Now did a right click on same package and selected export
> option->Java
> >> > tab->JAR File->Selected the path for package -> finish
> >> >
> >> > 3) This created jar file in specified location. Now followed in cmd  ,
> >> jar
> >> > tfv
> >> > org.apache.pointcross.synonym. the following was desc in cmd.
> >> >
> >> > :\Apps\Rajani Eclipse\Solr141_jar>jar -
> >> > tfv org.apache.pointcross.synonym.Synonym.jar
> >> >  25 Mon Apr 25 11:32:12 GMT+05:30 2011 META-INF/MANIFEST.MF
> >> >  383 Thu Apr 14 16:36:00 GMT+05:30 2011 .project
> >> >  2261 Fri Apr 22 16:26:12 GMT+05:30 2011 .classpath
> >> >  1017 Thu Apr 21 16:34:20 GMT+05:30 2011 jarLog.jardesc
> >> >
> >> > 4) Now placed same jar file in solr home/lib folder .Solrconfig.xml
> >> >  enabled <lib dir="./lib" /> and in schema  <filter
> >> class="synonym.Synonym"
> >> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >> >
> >> > 5) Restart tomcat : http://localhost:8097/finding1
> >> >
> >> > Error SEVERE: org.apache.solr.common.SolrException: Error loading
> class
> >> > 'pointcross.synonym.Synonym'
> >> > at
> >> >
> >>
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
> >> > at
> >> >
> >>
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
> >> > at
> >> >
> >>
> org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:84)
> >> > at
> >> >
> >>
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:141)
> >> > at
> org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:835)
> >> > at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:58)
> >> >
> >> >
> >> > I am basically trying to enable this jar functionality to solr. Please
> >> let
> >> > me know the mistake here.
> >> >
> >> > Rajani
> >> >
> >> >
> >> >
> >> >
> >> > On Fri, Apr 22, 2011 at 6:29 PM, Erick Erickson <
> erickerickson@gmail.com
> >> >wrote:
> >> >
> >> >> First I appreciate your writeup of the problem, it's very helpful
> when
> >> >> people
> >> >> take the time to put in the details....
> >> >>
> >> >> I can't reconcile these two things:
> >> >>
> >> >> {{{<filter class="org.apache.pco.search.orchSynonymFilterFactory"
> >> >> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >> >>
> >> >> as org.apache.solr.common.SolrException: Error loading class
> >> >> 'pointcross.orchSynonymFilterFactory' at}}}
> >> >>
> >> >> This seems to indicate that your config file is really looking for
> >> >> "pointcross.orchSynonymFilterFactory" rather than
> >> >> "org.apache....pco.search.orchSynonymFilterFactory".
> >> >>
> >> >> Do you perhaps have another definition in your config
> >> >> "pointcross.orchSynonymFilterFactory"?
> >> >>
> >> >> Try running "jar -tfv <your jar file>" to see what classes
> >> >> are actually defined in the file in the solr lib directory. Perhaps
> >> >> it's not what you expect (Perhaps Eclipse did something
> >> >> unexpected).
> >> >>
> >> >> Given the anomaly above (the error reported doesn't correspond to
> >> >> the class you defined) I'd also look to see if you have any old
> >> >> jars lying around that you somehow get to first.
> >> >>
> >> >> Finally, is there any chance that your
> >> >> "pointcross.orchSynonymFilterFactory"
> >> >> is a dependency of
> "org.apache....pco.search.orchSynonymFilterFactory"?
> >> In
> >> >> which case Solr may be finding
> >> >> "org.apache....pco.search.orchSynonymFilterFactory"
> >> >> but failing to load a dependency (that would have to be put in the
> lib
> >> >> or the jar).
> >> >>
> >> >> Hope that helps
> >> >> Erick
> >> >>
> >> >>
> >> >>
> >> >> On Fri, Apr 22, 2011 at 3:00 AM, rajini maski <rajinimaski@gmail.com
> >
> >> >> wrote:
> >> >> > One doubt regarding adding the solr plugin.
> >> >> >
> >> >> >
> >> >> >          I have a new java file created that includes few changes
> in
> >> >> > SynonymFilterFactory.java. I want this java file to be added to
> solr
> >> >> > instance.
> >> >> >
> >> >> > I created a package as : org.apache.pco.search
> >> >> > This includes OrcSynonymFilterFactory java class extends
> >> >> > BaseTokenFilterFactory implements ResourceLoaderAware {code.....}
> >> >> >
> >> >> > Packages included: import org.apache.solr.analysis.*;
> >> >> >
> >> >> > import org.apache.lucene.analysis.Token;
> >> >> > import org.apache.lucene.analysis.TokenStream;
> >> >> > import org.apache.solr.common.ResourceLoader;
> >> >> > import org.apache.solr.common.util.StrUtils;
> >> >> > import org.apache.solr.util.plugin.ResourceLoaderAware;
> >> >> >
> >> >> > import java.io.File;
> >> >> > import java.io.IOException;
> >> >> > import java.io.Reader;
> >> >> > import java.io.StringReader;
> >> >> > import java.util.ArrayList;
> >> >> > import java.util.List;
> >> >> >
> >> >> >
> >> >> >  I exported this java file in eclipse,
> >> >> >  selecting  File tab-Export to package
> >> >> > -org.apache.pco.search-OrchSynonymFilterFactory.java
> >> >> >  and generated jar file -
> org.apache.pco.orchSynonymFilterFactory.jar
> >> >> >
> >> >> >  This jar file placed in /lib folder of solr home instance
> >> >> >  Changes in solr config - <lib dir="./lib" />
> >> >> >
> >> >> >  Now i want to add this in schema fieldtype for synonym filter as
> >> >> >
> >> >> > <filter class="org.apache.pco.search.orchSynonymFilterFactory"
> >> >> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >> >> >
> >> >> > But i am not able to do it.." It has an error
> >> >> > as org.apache.solr.common.SolrException: Error loading class
> >> >> > 'pointcross.orchSynonymFilterFactory' at
> >> >> >
> >> >>
> >>
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
> >> >> > at
> >> >> >
> >> >>
> >>
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
> >> >> > at org.apache.solr.util.plugin.AbstractPluginLoader"
> >> >> >
> >> >> > Please can anyone tell me , What is the mistake i am doing here and
> >> the
> >> >> fix
> >> >> > for it ?
> >> >> >
> >> >> > Rajani
> >> >> >
> >> >>
> >> >
> >>
> >
>

Re: Query regarding solr plugin.

Posted by Erick Erickson <er...@gmail.com>.
Sorry, but there's too much here to debug remotely. I strongly advise you
back waaaay up. Undo (but save) all your changes. Start by doing
the simplest thing you can, just get a dummy class in place and
get it called. Perhaps create a really dumb logger method that
opens a text file, writes a message, and closes the file. Inefficient
I know, but this is just to find out the problem. Debugging by println is
an ancient technique...

Once you're certain the dummy class is called, gradually build it up
to the complex class you eventually want.

One problem here is that you've changed a bunch of moving parts, copied
jars around (it's unclear whether you have two copies of solr-core in your
classpath, for instance). So knowing exactly which one of those is the issue
is very difficult, especially since you may have forgotten one of the things
you did. I know when I've been trying to do something for days, lots of
details get lost.

Try to avoid changing the underlying Solr code, can you do what you want
by subclassing instead and calling your new class? That would avoid
a bunch of problems.  If you can't subclass, copy the whole thing and
rename it to something new and call *that* rather than re-use the
synonymfilterfactory. The only jar you should copy to the <lib> directory
would be the one you put your new class in.

I can't emphasize strongly enough that you'll save yourself lots of grief if
you start with a fresh install and build up gradually rather than try to
unravel the current code. It feels wasteful, but winds up being faster in
my experience...

Good Luck!
Erick

On Tue, Apr 26, 2011 at 12:41 AM, rajini maski <ra...@gmail.com> wrote:
> Thanks Erick. I have added my replies to the points you did mention. I am
> somewhere going wrong. I guess do I need to club both the jars or something
> ? If yes, how do i do that? I have no much idea about java and jar files.
> Please guide me here.
>
> A couple of things to try.
>
> 1> when you do a 'jar -tfv <yourjar>", you should see
> output like:
>  1183 Sun Jun 06 01:31:14 EDT 2010
> org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
> and your <filter> statement may need the whole path, in this example...
> <filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../> (note,
> this
> is just an example of the pathing, this class has nothing to do with
> your filter)...
>
> I could see this output..
>
> 2> But I'm guessing your path is actually OK, because I'd expect to be
> seeing a
> "class not found" error. So my guess is that your class depends on
> other jars that
> aren't packaged up in your jar and if you find which ones they are and copy
> them
> to your lib directory you'll be OK. Or your code is throwing an error
> on load. Or
> something like that...
>
> There is jar - "apache-solr-core-1.4.1.jar" this has the
> BaseTokenFilterFacotry class and the Synonymfilterfactory class..I made the
> changes in second class file and created it as new. Now i created a jar of
> that java file and placed this in solr home/lib and also placed
> "apache-solr-core-1.4.1.jar" file in lib folder of solr home.  [solr home -
> c:\orch\search\solr  lib path - c:\orch\search\solr\lib]
>
> 3> to try to understand what's up, I'd back up a step. Make a really
> stupid class
> that doesn't do anything except derive from BaseTokenFilterFacotry and see
> if
> you can load that. If you can, then your process is OK and you need to
> find out what classes your new filter depend on. If you still can't, then we
> can
> see what else we can come up with..
>
>
> I am perhaps doing same. In the synonymfilterfactory class, there is a
> function parse rules which takes delimiters as one of the input parameter.
> Here i changed  comma ',' to '~' tilde symbol and  thats it.
>
>
> Regards,
> Rajani
>
>
> On Mon, Apr 25, 2011 at 6:26 PM, Erick Erickson <er...@gmail.com>wrote:
>
>> Looking at things more carefully, it may be one of your dependent classes
>> that's not being found.
>>
>> A couple of things to try.
>>
>> 1> when you do a 'jar -tfv <yourjar>", you should see
>> output like:
>>  1183 Sun Jun 06 01:31:14 EDT 2010
>> org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
>> and your <filter> statement may need the whole path, in this example...
>> <filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../> (note,
>> this
>> is just an example of the pathing, this class has nothing to do with
>> your filter)...
>>
>> 2> But I'm guessing your path is actually OK, because I'd expect to be
>> seeing a
>> "class not found" error. So my guess is that your class depends on
>> other jars that
>> aren't packaged up in your jar and if you find which ones they are and copy
>> them
>> to your lib directory you'll be OK. Or your code is throwing an error
>> on load. Or
>> something like that...
>>
>> 3> to try to understand what's up, I'd back up a step. Make a really
>> stupid class
>> that doesn't do anything except derive from BaseTokenFilterFacotry and see
>> if
>> you can load that. If you can, then your process is OK and you need to
>> find out what classes your new filter depend on. If you still can't, then
>> we can
>> see what else we can come up with..
>>
>> Best
>> Erick
>>
>> On Mon, Apr 25, 2011 at 2:34 AM, rajini maski <ra...@gmail.com>
>> wrote:
>> > Erick ,
>> > *
>> > *
>> > * Thanks.* It was actually a copy mistake. Anyways i did a redo of all
>> the
>> > below mentioned steps. I had given class name as
>> > <filter class="pointcross.orchSynonymFilterFactory"
>> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >
>> > I did it again now following few different steps following this link :
>> >
>> http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-32.htm
>> >
>> >
>> > 1 ) Created new package in src folder .
>> *org.apache.pointcross.synonym*.This
>> > is having class Synonym.java
>> >
>> > 2) Now did a right click on same package and selected export option->Java
>> > tab->JAR File->Selected the path for package -> finish
>> >
>> > 3) This created jar file in specified location. Now followed in cmd  ,
>> jar
>> > tfv
>> > org.apache.pointcross.synonym. the following was desc in cmd.
>> >
>> > :\Apps\Rajani Eclipse\Solr141_jar>jar -
>> > tfv org.apache.pointcross.synonym.Synonym.jar
>> >  25 Mon Apr 25 11:32:12 GMT+05:30 2011 META-INF/MANIFEST.MF
>> >  383 Thu Apr 14 16:36:00 GMT+05:30 2011 .project
>> >  2261 Fri Apr 22 16:26:12 GMT+05:30 2011 .classpath
>> >  1017 Thu Apr 21 16:34:20 GMT+05:30 2011 jarLog.jardesc
>> >
>> > 4) Now placed same jar file in solr home/lib folder .Solrconfig.xml
>> >  enabled <lib dir="./lib" /> and in schema  <filter
>> class="synonym.Synonym"
>> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >
>> > 5) Restart tomcat : http://localhost:8097/finding1
>> >
>> > Error SEVERE: org.apache.solr.common.SolrException: Error loading class
>> > 'pointcross.synonym.Synonym'
>> > at
>> >
>> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
>> > at
>> >
>> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
>> > at
>> >
>> org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:84)
>> > at
>> >
>> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:141)
>> > at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:835)
>> > at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:58)
>> >
>> >
>> > I am basically trying to enable this jar functionality to solr. Please
>> let
>> > me know the mistake here.
>> >
>> > Rajani
>> >
>> >
>> >
>> >
>> > On Fri, Apr 22, 2011 at 6:29 PM, Erick Erickson <erickerickson@gmail.com
>> >wrote:
>> >
>> >> First I appreciate your writeup of the problem, it's very helpful when
>> >> people
>> >> take the time to put in the details....
>> >>
>> >> I can't reconcile these two things:
>> >>
>> >> {{{<filter class="org.apache.pco.search.orchSynonymFilterFactory"
>> >> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >>
>> >> as org.apache.solr.common.SolrException: Error loading class
>> >> 'pointcross.orchSynonymFilterFactory' at}}}
>> >>
>> >> This seems to indicate that your config file is really looking for
>> >> "pointcross.orchSynonymFilterFactory" rather than
>> >> "org.apache....pco.search.orchSynonymFilterFactory".
>> >>
>> >> Do you perhaps have another definition in your config
>> >> "pointcross.orchSynonymFilterFactory"?
>> >>
>> >> Try running "jar -tfv <your jar file>" to see what classes
>> >> are actually defined in the file in the solr lib directory. Perhaps
>> >> it's not what you expect (Perhaps Eclipse did something
>> >> unexpected).
>> >>
>> >> Given the anomaly above (the error reported doesn't correspond to
>> >> the class you defined) I'd also look to see if you have any old
>> >> jars lying around that you somehow get to first.
>> >>
>> >> Finally, is there any chance that your
>> >> "pointcross.orchSynonymFilterFactory"
>> >> is a dependency of "org.apache....pco.search.orchSynonymFilterFactory"?
>> In
>> >> which case Solr may be finding
>> >> "org.apache....pco.search.orchSynonymFilterFactory"
>> >> but failing to load a dependency (that would have to be put in the lib
>> >> or the jar).
>> >>
>> >> Hope that helps
>> >> Erick
>> >>
>> >>
>> >>
>> >> On Fri, Apr 22, 2011 at 3:00 AM, rajini maski <ra...@gmail.com>
>> >> wrote:
>> >> > One doubt regarding adding the solr plugin.
>> >> >
>> >> >
>> >> >          I have a new java file created that includes few changes in
>> >> > SynonymFilterFactory.java. I want this java file to be added to solr
>> >> > instance.
>> >> >
>> >> > I created a package as : org.apache.pco.search
>> >> > This includes OrcSynonymFilterFactory java class extends
>> >> > BaseTokenFilterFactory implements ResourceLoaderAware {code.....}
>> >> >
>> >> > Packages included: import org.apache.solr.analysis.*;
>> >> >
>> >> > import org.apache.lucene.analysis.Token;
>> >> > import org.apache.lucene.analysis.TokenStream;
>> >> > import org.apache.solr.common.ResourceLoader;
>> >> > import org.apache.solr.common.util.StrUtils;
>> >> > import org.apache.solr.util.plugin.ResourceLoaderAware;
>> >> >
>> >> > import java.io.File;
>> >> > import java.io.IOException;
>> >> > import java.io.Reader;
>> >> > import java.io.StringReader;
>> >> > import java.util.ArrayList;
>> >> > import java.util.List;
>> >> >
>> >> >
>> >> >  I exported this java file in eclipse,
>> >> >  selecting  File tab-Export to package
>> >> > -org.apache.pco.search-OrchSynonymFilterFactory.java
>> >> >  and generated jar file - org.apache.pco.orchSynonymFilterFactory.jar
>> >> >
>> >> >  This jar file placed in /lib folder of solr home instance
>> >> >  Changes in solr config - <lib dir="./lib" />
>> >> >
>> >> >  Now i want to add this in schema fieldtype for synonym filter as
>> >> >
>> >> > <filter class="org.apache.pco.search.orchSynonymFilterFactory"
>> >> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >> >
>> >> > But i am not able to do it.." It has an error
>> >> > as org.apache.solr.common.SolrException: Error loading class
>> >> > 'pointcross.orchSynonymFilterFactory' at
>> >> >
>> >>
>> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
>> >> > at
>> >> >
>> >>
>> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
>> >> > at org.apache.solr.util.plugin.AbstractPluginLoader"
>> >> >
>> >> > Please can anyone tell me , What is the mistake i am doing here and
>> the
>> >> fix
>> >> > for it ?
>> >> >
>> >> > Rajani
>> >> >
>> >>
>> >
>>
>

Re: Query regarding solr plugin.

Posted by rajini maski <ra...@gmail.com>.
Thanks Erick. I have added my replies to the points you did mention. I am
somewhere going wrong. I guess do I need to club both the jars or something
? If yes, how do i do that? I have no much idea about java and jar files.
Please guide me here.

A couple of things to try.

1> when you do a 'jar -tfv <yourjar>", you should see
output like:
 1183 Sun Jun 06 01:31:14 EDT 2010
org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
and your <filter> statement may need the whole path, in this example...
<filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../> (note,
this
is just an example of the pathing, this class has nothing to do with
your filter)...

I could see this output..

2> But I'm guessing your path is actually OK, because I'd expect to be
seeing a
"class not found" error. So my guess is that your class depends on
other jars that
aren't packaged up in your jar and if you find which ones they are and copy
them
to your lib directory you'll be OK. Or your code is throwing an error
on load. Or
something like that...

There is jar - "apache-solr-core-1.4.1.jar" this has the
BaseTokenFilterFacotry class and the Synonymfilterfactory class..I made the
changes in second class file and created it as new. Now i created a jar of
that java file and placed this in solr home/lib and also placed
"apache-solr-core-1.4.1.jar" file in lib folder of solr home.  [solr home -
c:\orch\search\solr  lib path - c:\orch\search\solr\lib]

3> to try to understand what's up, I'd back up a step. Make a really
stupid class
that doesn't do anything except derive from BaseTokenFilterFacotry and see
if
you can load that. If you can, then your process is OK and you need to
find out what classes your new filter depend on. If you still can't, then we
can
see what else we can come up with..


I am perhaps doing same. In the synonymfilterfactory class, there is a
function parse rules which takes delimiters as one of the input parameter.
Here i changed  comma ',' to '~' tilde symbol and  thats it.


Regards,
Rajani


On Mon, Apr 25, 2011 at 6:26 PM, Erick Erickson <er...@gmail.com>wrote:

> Looking at things more carefully, it may be one of your dependent classes
> that's not being found.
>
> A couple of things to try.
>
> 1> when you do a 'jar -tfv <yourjar>", you should see
> output like:
>  1183 Sun Jun 06 01:31:14 EDT 2010
> org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
> and your <filter> statement may need the whole path, in this example...
> <filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../> (note,
> this
> is just an example of the pathing, this class has nothing to do with
> your filter)...
>
> 2> But I'm guessing your path is actually OK, because I'd expect to be
> seeing a
> "class not found" error. So my guess is that your class depends on
> other jars that
> aren't packaged up in your jar and if you find which ones they are and copy
> them
> to your lib directory you'll be OK. Or your code is throwing an error
> on load. Or
> something like that...
>
> 3> to try to understand what's up, I'd back up a step. Make a really
> stupid class
> that doesn't do anything except derive from BaseTokenFilterFacotry and see
> if
> you can load that. If you can, then your process is OK and you need to
> find out what classes your new filter depend on. If you still can't, then
> we can
> see what else we can come up with..
>
> Best
> Erick
>
> On Mon, Apr 25, 2011 at 2:34 AM, rajini maski <ra...@gmail.com>
> wrote:
> > Erick ,
> > *
> > *
> > * Thanks.* It was actually a copy mistake. Anyways i did a redo of all
> the
> > below mentioned steps. I had given class name as
> > <filter class="pointcross.orchSynonymFilterFactory"
> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >
> > I did it again now following few different steps following this link :
> >
> http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-32.htm
> >
> >
> > 1 ) Created new package in src folder .
> *org.apache.pointcross.synonym*.This
> > is having class Synonym.java
> >
> > 2) Now did a right click on same package and selected export option->Java
> > tab->JAR File->Selected the path for package -> finish
> >
> > 3) This created jar file in specified location. Now followed in cmd  ,
> jar
> > tfv
> > org.apache.pointcross.synonym. the following was desc in cmd.
> >
> > :\Apps\Rajani Eclipse\Solr141_jar>jar -
> > tfv org.apache.pointcross.synonym.Synonym.jar
> >  25 Mon Apr 25 11:32:12 GMT+05:30 2011 META-INF/MANIFEST.MF
> >  383 Thu Apr 14 16:36:00 GMT+05:30 2011 .project
> >  2261 Fri Apr 22 16:26:12 GMT+05:30 2011 .classpath
> >  1017 Thu Apr 21 16:34:20 GMT+05:30 2011 jarLog.jardesc
> >
> > 4) Now placed same jar file in solr home/lib folder .Solrconfig.xml
> >  enabled <lib dir="./lib" /> and in schema  <filter
> class="synonym.Synonym"
> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >
> > 5) Restart tomcat : http://localhost:8097/finding1
> >
> > Error SEVERE: org.apache.solr.common.SolrException: Error loading class
> > 'pointcross.synonym.Synonym'
> > at
> >
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
> > at
> >
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
> > at
> >
> org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:84)
> > at
> >
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:141)
> > at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:835)
> > at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:58)
> >
> >
> > I am basically trying to enable this jar functionality to solr. Please
> let
> > me know the mistake here.
> >
> > Rajani
> >
> >
> >
> >
> > On Fri, Apr 22, 2011 at 6:29 PM, Erick Erickson <erickerickson@gmail.com
> >wrote:
> >
> >> First I appreciate your writeup of the problem, it's very helpful when
> >> people
> >> take the time to put in the details....
> >>
> >> I can't reconcile these two things:
> >>
> >> {{{<filter class="org.apache.pco.search.orchSynonymFilterFactory"
> >> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >>
> >> as org.apache.solr.common.SolrException: Error loading class
> >> 'pointcross.orchSynonymFilterFactory' at}}}
> >>
> >> This seems to indicate that your config file is really looking for
> >> "pointcross.orchSynonymFilterFactory" rather than
> >> "org.apache....pco.search.orchSynonymFilterFactory".
> >>
> >> Do you perhaps have another definition in your config
> >> "pointcross.orchSynonymFilterFactory"?
> >>
> >> Try running "jar -tfv <your jar file>" to see what classes
> >> are actually defined in the file in the solr lib directory. Perhaps
> >> it's not what you expect (Perhaps Eclipse did something
> >> unexpected).
> >>
> >> Given the anomaly above (the error reported doesn't correspond to
> >> the class you defined) I'd also look to see if you have any old
> >> jars lying around that you somehow get to first.
> >>
> >> Finally, is there any chance that your
> >> "pointcross.orchSynonymFilterFactory"
> >> is a dependency of "org.apache....pco.search.orchSynonymFilterFactory"?
> In
> >> which case Solr may be finding
> >> "org.apache....pco.search.orchSynonymFilterFactory"
> >> but failing to load a dependency (that would have to be put in the lib
> >> or the jar).
> >>
> >> Hope that helps
> >> Erick
> >>
> >>
> >>
> >> On Fri, Apr 22, 2011 at 3:00 AM, rajini maski <ra...@gmail.com>
> >> wrote:
> >> > One doubt regarding adding the solr plugin.
> >> >
> >> >
> >> >          I have a new java file created that includes few changes in
> >> > SynonymFilterFactory.java. I want this java file to be added to solr
> >> > instance.
> >> >
> >> > I created a package as : org.apache.pco.search
> >> > This includes OrcSynonymFilterFactory java class extends
> >> > BaseTokenFilterFactory implements ResourceLoaderAware {code.....}
> >> >
> >> > Packages included: import org.apache.solr.analysis.*;
> >> >
> >> > import org.apache.lucene.analysis.Token;
> >> > import org.apache.lucene.analysis.TokenStream;
> >> > import org.apache.solr.common.ResourceLoader;
> >> > import org.apache.solr.common.util.StrUtils;
> >> > import org.apache.solr.util.plugin.ResourceLoaderAware;
> >> >
> >> > import java.io.File;
> >> > import java.io.IOException;
> >> > import java.io.Reader;
> >> > import java.io.StringReader;
> >> > import java.util.ArrayList;
> >> > import java.util.List;
> >> >
> >> >
> >> >  I exported this java file in eclipse,
> >> >  selecting  File tab-Export to package
> >> > -org.apache.pco.search-OrchSynonymFilterFactory.java
> >> >  and generated jar file - org.apache.pco.orchSynonymFilterFactory.jar
> >> >
> >> >  This jar file placed in /lib folder of solr home instance
> >> >  Changes in solr config - <lib dir="./lib" />
> >> >
> >> >  Now i want to add this in schema fieldtype for synonym filter as
> >> >
> >> > <filter class="org.apache.pco.search.orchSynonymFilterFactory"
> >> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >> >
> >> > But i am not able to do it.." It has an error
> >> > as org.apache.solr.common.SolrException: Error loading class
> >> > 'pointcross.orchSynonymFilterFactory' at
> >> >
> >>
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
> >> > at
> >> >
> >>
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
> >> > at org.apache.solr.util.plugin.AbstractPluginLoader"
> >> >
> >> > Please can anyone tell me , What is the mistake i am doing here and
> the
> >> fix
> >> > for it ?
> >> >
> >> > Rajani
> >> >
> >>
> >
>

Re: Query regarding solr plugin.

Posted by Erick Erickson <er...@gmail.com>.
Looking at things more carefully, it may be one of your dependent classes
that's not being found.

A couple of things to try.

1> when you do a 'jar -tfv <yourjar>", you should see
output like:
 1183 Sun Jun 06 01:31:14 EDT 2010
org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
and your <filter> statement may need the whole path, in this example...
<filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../> (note, this
is just an example of the pathing, this class has nothing to do with
your filter)...

2> But I'm guessing your path is actually OK, because I'd expect to be seeing a
"class not found" error. So my guess is that your class depends on
other jars that
aren't packaged up in your jar and if you find which ones they are and copy them
to your lib directory you'll be OK. Or your code is throwing an error
on load. Or
something like that...

3> to try to understand what's up, I'd back up a step. Make a really
stupid class
that doesn't do anything except derive from BaseTokenFilterFacotry and see if
you can load that. If you can, then your process is OK and you need to
find out what classes your new filter depend on. If you still can't, then we can
see what else we can come up with..

Best
Erick

On Mon, Apr 25, 2011 at 2:34 AM, rajini maski <ra...@gmail.com> wrote:
> Erick ,
> *
> *
> * Thanks.* It was actually a copy mistake. Anyways i did a redo of all the
> below mentioned steps. I had given class name as
> <filter class="pointcross.orchSynonymFilterFactory"
> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>
> I did it again now following few different steps following this link :
> http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-32.htm
>
>
> 1 ) Created new package in src folder . *org.apache.pointcross.synonym*.This
> is having class Synonym.java
>
> 2) Now did a right click on same package and selected export option->Java
> tab->JAR File->Selected the path for package -> finish
>
> 3) This created jar file in specified location. Now followed in cmd  , jar
> tfv
> org.apache.pointcross.synonym. the following was desc in cmd.
>
> :\Apps\Rajani Eclipse\Solr141_jar>jar -
> tfv org.apache.pointcross.synonym.Synonym.jar
>  25 Mon Apr 25 11:32:12 GMT+05:30 2011 META-INF/MANIFEST.MF
>  383 Thu Apr 14 16:36:00 GMT+05:30 2011 .project
>  2261 Fri Apr 22 16:26:12 GMT+05:30 2011 .classpath
>  1017 Thu Apr 21 16:34:20 GMT+05:30 2011 jarLog.jardesc
>
> 4) Now placed same jar file in solr home/lib folder .Solrconfig.xml
>  enabled <lib dir="./lib" /> and in schema  <filter class="synonym.Synonym"
> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>
> 5) Restart tomcat : http://localhost:8097/finding1
>
> Error SEVERE: org.apache.solr.common.SolrException: Error loading class
> 'pointcross.synonym.Synonym'
> at
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
> at
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
> at
> org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:84)
> at
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:141)
> at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:835)
> at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:58)
>
>
> I am basically trying to enable this jar functionality to solr. Please let
> me know the mistake here.
>
> Rajani
>
>
>
>
> On Fri, Apr 22, 2011 at 6:29 PM, Erick Erickson <er...@gmail.com>wrote:
>
>> First I appreciate your writeup of the problem, it's very helpful when
>> people
>> take the time to put in the details....
>>
>> I can't reconcile these two things:
>>
>> {{{<filter class="org.apache.pco.search.orchSynonymFilterFactory"
>> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>>
>> as org.apache.solr.common.SolrException: Error loading class
>> 'pointcross.orchSynonymFilterFactory' at}}}
>>
>> This seems to indicate that your config file is really looking for
>> "pointcross.orchSynonymFilterFactory" rather than
>> "org.apache....pco.search.orchSynonymFilterFactory".
>>
>> Do you perhaps have another definition in your config
>> "pointcross.orchSynonymFilterFactory"?
>>
>> Try running "jar -tfv <your jar file>" to see what classes
>> are actually defined in the file in the solr lib directory. Perhaps
>> it's not what you expect (Perhaps Eclipse did something
>> unexpected).
>>
>> Given the anomaly above (the error reported doesn't correspond to
>> the class you defined) I'd also look to see if you have any old
>> jars lying around that you somehow get to first.
>>
>> Finally, is there any chance that your
>> "pointcross.orchSynonymFilterFactory"
>> is a dependency of "org.apache....pco.search.orchSynonymFilterFactory"? In
>> which case Solr may be finding
>> "org.apache....pco.search.orchSynonymFilterFactory"
>> but failing to load a dependency (that would have to be put in the lib
>> or the jar).
>>
>> Hope that helps
>> Erick
>>
>>
>>
>> On Fri, Apr 22, 2011 at 3:00 AM, rajini maski <ra...@gmail.com>
>> wrote:
>> > One doubt regarding adding the solr plugin.
>> >
>> >
>> >          I have a new java file created that includes few changes in
>> > SynonymFilterFactory.java. I want this java file to be added to solr
>> > instance.
>> >
>> > I created a package as : org.apache.pco.search
>> > This includes OrcSynonymFilterFactory java class extends
>> > BaseTokenFilterFactory implements ResourceLoaderAware {code.....}
>> >
>> > Packages included: import org.apache.solr.analysis.*;
>> >
>> > import org.apache.lucene.analysis.Token;
>> > import org.apache.lucene.analysis.TokenStream;
>> > import org.apache.solr.common.ResourceLoader;
>> > import org.apache.solr.common.util.StrUtils;
>> > import org.apache.solr.util.plugin.ResourceLoaderAware;
>> >
>> > import java.io.File;
>> > import java.io.IOException;
>> > import java.io.Reader;
>> > import java.io.StringReader;
>> > import java.util.ArrayList;
>> > import java.util.List;
>> >
>> >
>> >  I exported this java file in eclipse,
>> >  selecting  File tab-Export to package
>> > -org.apache.pco.search-OrchSynonymFilterFactory.java
>> >  and generated jar file - org.apache.pco.orchSynonymFilterFactory.jar
>> >
>> >  This jar file placed in /lib folder of solr home instance
>> >  Changes in solr config - <lib dir="./lib" />
>> >
>> >  Now i want to add this in schema fieldtype for synonym filter as
>> >
>> > <filter class="org.apache.pco.search.orchSynonymFilterFactory"
>> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >
>> > But i am not able to do it.." It has an error
>> > as org.apache.solr.common.SolrException: Error loading class
>> > 'pointcross.orchSynonymFilterFactory' at
>> >
>> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
>> > at
>> >
>> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
>> > at org.apache.solr.util.plugin.AbstractPluginLoader"
>> >
>> > Please can anyone tell me , What is the mistake i am doing here and the
>> fix
>> > for it ?
>> >
>> > Rajani
>> >
>>
>

Re: Query regarding solr plugin.

Posted by rajini maski <ra...@gmail.com>.
Erick ,
*
*
* Thanks.* It was actually a copy mistake. Anyways i did a redo of all the
below mentioned steps. I had given class name as
<filter class="pointcross.orchSynonymFilterFactory"
synonyms="synonyms.txt" ignoreCase="true" expand="true"/>

I did it again now following few different steps following this link :
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-32.htm


1 ) Created new package in src folder . *org.apache.pointcross.synonym*.This
is having class Synonym.java

2) Now did a right click on same package and selected export option->Java
tab->JAR File->Selected the path for package -> finish

3) This created jar file in specified location. Now followed in cmd  , jar
tfv
org.apache.pointcross.synonym. the following was desc in cmd.

:\Apps\Rajani Eclipse\Solr141_jar>jar -
tfv org.apache.pointcross.synonym.Synonym.jar
  25 Mon Apr 25 11:32:12 GMT+05:30 2011 META-INF/MANIFEST.MF
  383 Thu Apr 14 16:36:00 GMT+05:30 2011 .project
 2261 Fri Apr 22 16:26:12 GMT+05:30 2011 .classpath
 1017 Thu Apr 21 16:34:20 GMT+05:30 2011 jarLog.jardesc

4) Now placed same jar file in solr home/lib folder .Solrconfig.xml
 enabled <lib dir="./lib" /> and in schema  <filter class="synonym.Synonym"
synonyms="synonyms.txt" ignoreCase="true" expand="true"/>

5) Restart tomcat : http://localhost:8097/finding1

Error SEVERE: org.apache.solr.common.SolrException: Error loading class
'pointcross.synonym.Synonym'
at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
at
org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
at
org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:84)
at
org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:141)
at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:835)
at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:58)


I am basically trying to enable this jar functionality to solr. Please let
me know the mistake here.

Rajani




On Fri, Apr 22, 2011 at 6:29 PM, Erick Erickson <er...@gmail.com>wrote:

> First I appreciate your writeup of the problem, it's very helpful when
> people
> take the time to put in the details....
>
> I can't reconcile these two things:
>
> {{{<filter class="org.apache.pco.search.orchSynonymFilterFactory"
> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>
> as org.apache.solr.common.SolrException: Error loading class
> 'pointcross.orchSynonymFilterFactory' at}}}
>
> This seems to indicate that your config file is really looking for
> "pointcross.orchSynonymFilterFactory" rather than
> "org.apache....pco.search.orchSynonymFilterFactory".
>
> Do you perhaps have another definition in your config
> "pointcross.orchSynonymFilterFactory"?
>
> Try running "jar -tfv <your jar file>" to see what classes
> are actually defined in the file in the solr lib directory. Perhaps
> it's not what you expect (Perhaps Eclipse did something
> unexpected).
>
> Given the anomaly above (the error reported doesn't correspond to
> the class you defined) I'd also look to see if you have any old
> jars lying around that you somehow get to first.
>
> Finally, is there any chance that your
> "pointcross.orchSynonymFilterFactory"
> is a dependency of "org.apache....pco.search.orchSynonymFilterFactory"? In
> which case Solr may be finding
> "org.apache....pco.search.orchSynonymFilterFactory"
> but failing to load a dependency (that would have to be put in the lib
> or the jar).
>
> Hope that helps
> Erick
>
>
>
> On Fri, Apr 22, 2011 at 3:00 AM, rajini maski <ra...@gmail.com>
> wrote:
> > One doubt regarding adding the solr plugin.
> >
> >
> >          I have a new java file created that includes few changes in
> > SynonymFilterFactory.java. I want this java file to be added to solr
> > instance.
> >
> > I created a package as : org.apache.pco.search
> > This includes OrcSynonymFilterFactory java class extends
> > BaseTokenFilterFactory implements ResourceLoaderAware {code.....}
> >
> > Packages included: import org.apache.solr.analysis.*;
> >
> > import org.apache.lucene.analysis.Token;
> > import org.apache.lucene.analysis.TokenStream;
> > import org.apache.solr.common.ResourceLoader;
> > import org.apache.solr.common.util.StrUtils;
> > import org.apache.solr.util.plugin.ResourceLoaderAware;
> >
> > import java.io.File;
> > import java.io.IOException;
> > import java.io.Reader;
> > import java.io.StringReader;
> > import java.util.ArrayList;
> > import java.util.List;
> >
> >
> >  I exported this java file in eclipse,
> >  selecting  File tab-Export to package
> > -org.apache.pco.search-OrchSynonymFilterFactory.java
> >  and generated jar file - org.apache.pco.orchSynonymFilterFactory.jar
> >
> >  This jar file placed in /lib folder of solr home instance
> >  Changes in solr config - <lib dir="./lib" />
> >
> >  Now i want to add this in schema fieldtype for synonym filter as
> >
> > <filter class="org.apache.pco.search.orchSynonymFilterFactory"
> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
> >
> > But i am not able to do it.." It has an error
> > as org.apache.solr.common.SolrException: Error loading class
> > 'pointcross.orchSynonymFilterFactory' at
> >
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
> > at
> >
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
> > at org.apache.solr.util.plugin.AbstractPluginLoader"
> >
> > Please can anyone tell me , What is the mistake i am doing here and the
> fix
> > for it ?
> >
> > Rajani
> >
>

Re: Query regarding solr plugin.

Posted by Erick Erickson <er...@gmail.com>.
First I appreciate your writeup of the problem, it's very helpful when people
take the time to put in the details....

I can't reconcile these two things:

{{{<filter class="org.apache.pco.search.orchSynonymFilterFactory"
synonyms="synonyms.txt" ignoreCase="true" expand="true"/>

as org.apache.solr.common.SolrException: Error loading class
'pointcross.orchSynonymFilterFactory' at}}}

This seems to indicate that your config file is really looking for
"pointcross.orchSynonymFilterFactory" rather than
"org.apache....pco.search.orchSynonymFilterFactory".

Do you perhaps have another definition in your config
"pointcross.orchSynonymFilterFactory"?

Try running "jar -tfv <your jar file>" to see what classes
are actually defined in the file in the solr lib directory. Perhaps
it's not what you expect (Perhaps Eclipse did something
unexpected).

Given the anomaly above (the error reported doesn't correspond to
the class you defined) I'd also look to see if you have any old
jars lying around that you somehow get to first.

Finally, is there any chance that your "pointcross.orchSynonymFilterFactory"
is a dependency of "org.apache....pco.search.orchSynonymFilterFactory"? In
which case Solr may be finding
"org.apache....pco.search.orchSynonymFilterFactory"
but failing to load a dependency (that would have to be put in the lib
or the jar).

Hope that helps
Erick



On Fri, Apr 22, 2011 at 3:00 AM, rajini maski <ra...@gmail.com> wrote:
> One doubt regarding adding the solr plugin.
>
>
>          I have a new java file created that includes few changes in
> SynonymFilterFactory.java. I want this java file to be added to solr
> instance.
>
> I created a package as : org.apache.pco.search
> This includes OrcSynonymFilterFactory java class extends
> BaseTokenFilterFactory implements ResourceLoaderAware {code.....}
>
> Packages included: import org.apache.solr.analysis.*;
>
> import org.apache.lucene.analysis.Token;
> import org.apache.lucene.analysis.TokenStream;
> import org.apache.solr.common.ResourceLoader;
> import org.apache.solr.common.util.StrUtils;
> import org.apache.solr.util.plugin.ResourceLoaderAware;
>
> import java.io.File;
> import java.io.IOException;
> import java.io.Reader;
> import java.io.StringReader;
> import java.util.ArrayList;
> import java.util.List;
>
>
>  I exported this java file in eclipse,
>  selecting  File tab-Export to package
> -org.apache.pco.search-OrchSynonymFilterFactory.java
>  and generated jar file - org.apache.pco.orchSynonymFilterFactory.jar
>
>  This jar file placed in /lib folder of solr home instance
>  Changes in solr config - <lib dir="./lib" />
>
>  Now i want to add this in schema fieldtype for synonym filter as
>
> <filter class="org.apache.pco.search.orchSynonymFilterFactory"
> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>
> But i am not able to do it.." It has an error
> as org.apache.solr.common.SolrException: Error loading class
> 'pointcross.orchSynonymFilterFactory' at
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
> at
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
> at org.apache.solr.util.plugin.AbstractPluginLoader"
>
> Please can anyone tell me , What is the mistake i am doing here and the fix
> for it ?
>
> Rajani
>

Re: Multi-word Solr Synonym issue

Posted by Chris Hostetter <ho...@fucit.org>.
: Subject: Multi-word Solr Synonym issue
: In-Reply-To: <BA...@mail.gmail.com>

http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to 
an existing message, instead start a fresh email.  Even if you change the 
subject line of your email, other mail headers still track which thread 
you replied to and your question is "hidden" in that thread and gets less 
attention.   It makes following discussions in the mailing list archives 
particularly difficult.



-Hoss

Re: Multi-word Solr Synonym issue

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi,

Maybe you are doing query-time synonym expansion?
Try changing that to do index-time synonym expansion.

See 
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory


Otis
----
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
Lucene ecosystem search :: http://search-lucene.com/



----- Original Message ----
> From: Pla Gong <pg...@marketlive.com>
> To: solr-user@lucene.apache.org
> Sent: Fri, April 22, 2011 3:58:26 AM
> Subject: Multi-word Solr Synonym issue
> 
> I am trying to do a simple mapping of a 2 word term to a 1 word term and
> it  does not work. See my configuration at the bottom of the email. My
> scenario  is that I have a term called "pond care" and I want to map it
> to the term  "fountain".  So whenever a user enters the term "pond care"
> in the  search box, I want Solr to search on the word "fountain".
> Searching on   "fountain" or "pond food" should returns the same number
> of products.  I  try all type of filter combination and cannot get it to
> work.  I use the  Solr analysis and "pond food" does map to "fountain"
> but when test on Solr  Admin, the search would not query on "fountain"
> but only on "pond  care".  Here is my log from solr Admin search:
> 
> - <lst  name="debug">
> - <lst name="queryBoosting">
>   <str  name="q">fountain</str> 
>   <null name="match" /> 
>   </lst>
>   <str name="rawquerystring">pond  food</str> 
>   <str name="querystring">pond food</str> 
>   <str name="parsedquery">+text:pond +text:food</str> 
>   <str name="parsedquery_toString">+text:pond  +text:food</str> 
> - <lst name="explain">
>   <str  name="catalogItem.155.120.1">1.4865229 = (MATCH) sum of:
> 0.5013988 =  (MATCH) weight(text:pond in 1137), product of: 0.5317582  =
> queryWeight(text:pond), product of: 3.180518 =  idf(docFreq=730,
> maxDocs=6470) 0.16719232 = queryNorm 
> 
> I am new to  Solr and I have Google the issue but I did not find a
> solution that will work  for my case.  Please let me know if you  have
> encounter this issue  and how you resolved it and what configuration you
> used.  I want term to  term mapping results from the query and not a
> combination of the two  terms.
> 
> I would greatly appreciate any  help.
> 
> Thanks,
> Pla
> 
> -----------field type and filter  Configuration
> 
>     <fieldType name="text"  class="solr.TextField"
> positionIncrementGap="100">
>        <analyzer type="index">
>         <tokenizer  class="solr.WhitespaceTokenizerFactory"/>
>          <filter class="solr.StopFilterFactory"
>                  ignoreCase="true"
>                  words="stopwords.txt"
>                  enablePositionIncrements="true"
>                  />
>          <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1"  generateNumberParts="1" catenateWords="1"
> catenateNumbers="1" catenateAll="0"  splitOnCaseChange="1"/>
>         <filter  class="solr.LowerCaseFilterFactory"/>
>          <filter class="solr.SnowballPorterFilterFactory"
> language="English"  protected="protwords.txt"/>
>        </analyzer>
>       <analyzer  type="query">
>         <tokenizer  class="solr.KeywordTokenizerFactory"/>
>          <filter class="solr.SynonymFilterFactory"
> synonyms="synonyms.txt"  ignoreCase="true" expand="true"/>
>         <filter  class="solr.StopFilterFactory"
>                  ignoreCase="true"
>                  words="stopwords.txt"
>                  enablePositionIncrements="true"
>                  />
>         <filter  class="solr.WordDelimiterFilterFactory"
> generateWordParts="1"  generateNumberParts="1" catenateWords="0"
> catenateNumbers="0" catenateAll="0"  splitOnCaseChange="1"/>
>         <filter  class="solr.LowerCaseFilterFactory"/>
>          <filter class="solr.SnowballPorterFilterFactory"
> language="English"  protected="protwords.txt"/>
>        </analyzer>
>     </fieldType>
> 

Multi-word Solr Synonym issue

Posted by Pla Gong <pg...@marketlive.com>.
I am trying to do a simple mapping of a 2 word term to a 1 word term and
it does not work. See my configuration at the bottom of the email. My
scenario is that I have a term called "pond care" and I want to map it
to the term "fountain".  So whenever a user enters the term "pond care"
in the search box, I want Solr to search on the word "fountain".
Searching on  "fountain" or "pond food" should returns the same number
of products.  I try all type of filter combination and cannot get it to
work.  I use the Solr analysis and "pond food" does map to "fountain"
but when test on Solr Admin, the search would not query on "fountain"
but only on "pond care".  Here is my log from solr Admin search:

- <lst name="debug">
- <lst name="queryBoosting">
  <str name="q">fountain</str> 
  <null name="match" /> 
  </lst>
  <str name="rawquerystring">pond food</str> 
  <str name="querystring">pond food</str> 
  <str name="parsedquery">+text:pond +text:food</str> 
  <str name="parsedquery_toString">+text:pond +text:food</str> 
- <lst name="explain">
  <str name="catalogItem.155.120.1">1.4865229 = (MATCH) sum of:
0.5013988 = (MATCH) weight(text:pond in 1137), product of: 0.5317582 =
queryWeight(text:pond), product of: 3.180518 = idf(docFreq=730,
maxDocs=6470) 0.16719232 = queryNorm 

I am new to Solr and I have Google the issue but I did not find a
solution that will work for my case.  Please let me know if you  have
encounter this issue and how you resolved it and what configuration you
used.  I want term to term mapping results from the query and not a
combination of the two terms.

I would greatly appreciate any help.

Thanks,
Pla

-----------field type and filter Configuration

    <fieldType name="text" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.SnowballPorterFilterFactory"
language="English" protected="protwords.txt"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.SynonymFilterFactory"
synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="0"
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.SnowballPorterFilterFactory"
language="English" protected="protwords.txt"/>
      </analyzer>
    </fieldType>