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 Mingzhu Gao <mg...@adobe.com> on 2013/10/21 10:35:39 UTC

how to debug my own analyzer in solr

Dear solr expert ,

I would like to write my own analyser ( Chinese analyser ) and integrate them into solr as solr plugin .

>From the log information , the custom analyzer can be loaded into solr successfully .  I define my <fieldType> with this custom analyzer.

Now the problem is that ,  when I try this analyzer from http://localhost:8983/solr/#/collection1/analysis , click the analysis , then choose my FieldType , then input some text .
After I click "Analyse Value" button , the solr hang there , I cannot get any result or response in a few minutes.

I also try to add  some data by "curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" , or by "post.sh" in exampledocs folder ,
The same issue , the solr hang there , no result and not response .

Can anybody give me some suggestions on how to debug solr to work with my own custom analyzer ?

By the way , I write a java program to call my custom analyzer , the result is okay , for example , the following code can work well .
==============
Analyzer analyzer = new MyAnalyzer() ;

TokenStream ts = analyzer.tokenStream() ;

CharTermAttribute ta = ts.getAttribute(CharTermAttribute.class);

ts.reset();

while (ts.incrementToken()){

System.out.println(ta.toString());

}

=============


Thanks,

-Mingz


Re: how to debug my own analyzer in solr

Posted by Mingzhu Gao <mg...@adobe.com>.
Koji , thank you for reply.

I am just using the binary of solr.war , I will try to use the solr source
and have a try . 

-Mingz

On 10/21/13 6:21 PM, "Koji Sekiguchi" <ko...@r.email.ne.jp> wrote:

>Hi Mingz,
>
>If you use Eclipse, you can debug Solr with your plugin like this:
>
># go to Solr install directory
>$ cd $SOLR
>$ ant run-example -Dexample.debug=true
>
>Then connect the JVM from Eclipse via remote debug port 5005.
>
>Good luck!
>
>koji
>
>
>(13/10/21 18:58), Mingzhu Gao wrote:
>> More information about this , the custom analyzer just implement
>> "createComponents" of Analyzer.
>>
>> And my configure in schema.xml is just something like :
>>
>> <fieldType name="text_cn" class="solr.TextField" >
>>   <analyzer class="my.package.CustomAnalyzer" />
>> </fieldType>
>>
>>
>>>From the log I cannot see any error information , however , when I want
>>>to
>> analysis or add document data , it always hang there .
>>
>> Any way to debug or narrow down the problem ?
>>
>> Thanks in advance .
>>
>> -Mingz
>>
>> On 10/21/13 4:35 PM, "Mingzhu Gao" <mg...@adobe.com> wrote:
>>
>>> Dear solr expert ,
>>>
>>> I would like to write my own analyser ( Chinese analyser ) and
>>>integrate
>>> them into solr as solr plugin .
>>>
>>>From the log information , the custom analyzer can be loaded into solr
>>> successfully .  I define my <fieldType> with this custom analyzer.
>>>
>>> Now the problem is that ,  when I try this analyzer from
>>> http://localhost:8983/solr/#/collection1/analysis , click the analysis
>>>,
>>> then choose my FieldType , then input some text .
>>> After I click "Analyse Value" button , the solr hang there , I cannot
>>>get
>>> any result or response in a few minutes.
>>>
>>> I also try to add  some data by "curl
>>> http://localhost:8983/solr/update?commit=true -H "Content-Type:
>>>text/xml"
>>> , or by "post.sh" in exampledocs folder ,
>>> The same issue , the solr hang there , no result and not response .
>>>
>>> Can anybody give me some suggestions on how to debug solr to work with
>>>my
>>> own custom analyzer ?
>>>
>>> By the way , I write a java program to call my custom analyzer , the
>>> result is okay , for example , the following code can work well .
>>> ==============
>>> Analyzer analyzer = new MyAnalyzer() ;
>>>
>>> TokenStream ts = analyzer.tokenStream() ;
>>>
>>> CharTermAttribute ta = ts.getAttribute(CharTermAttribute.class);
>>>
>>> ts.reset();
>>>
>>> while (ts.incrementToken()){
>>>
>>> System.out.println(ta.toString());
>>>
>>> }
>>>
>>> =============
>>>
>>>
>>> Thanks,
>>>
>>> -Mingz
>>>
>>
>>
>
>
>-- 
>http://soleami.com/blog/automatically-acquiring-synonym-knowledge-from-wik
>ipedia.html


Re: how to debug my own analyzer in solr

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Hi Mingz,

If you use Eclipse, you can debug Solr with your plugin like this:

# go to Solr install directory
$ cd $SOLR
$ ant run-example -Dexample.debug=true

Then connect the JVM from Eclipse via remote debug port 5005.

Good luck!

koji


(13/10/21 18:58), Mingzhu Gao wrote:
> More information about this , the custom analyzer just implement
> "createComponents" of Analyzer.
>
> And my configure in schema.xml is just something like :
>
> <fieldType name="text_cn" class="solr.TextField" >
>   <analyzer class="my.package.CustomAnalyzer" />
> </fieldType>
>
>
>>From the log I cannot see any error information , however , when I want to
> analysis or add document data , it always hang there .
>
> Any way to debug or narrow down the problem ?
>
> Thanks in advance .
>
> -Mingz
>
> On 10/21/13 4:35 PM, "Mingzhu Gao" <mg...@adobe.com> wrote:
>
>> Dear solr expert ,
>>
>> I would like to write my own analyser ( Chinese analyser ) and integrate
>> them into solr as solr plugin .
>>
>>From the log information , the custom analyzer can be loaded into solr
>> successfully .  I define my <fieldType> with this custom analyzer.
>>
>> Now the problem is that ,  when I try this analyzer from
>> http://localhost:8983/solr/#/collection1/analysis , click the analysis ,
>> then choose my FieldType , then input some text .
>> After I click "Analyse Value" button , the solr hang there , I cannot get
>> any result or response in a few minutes.
>>
>> I also try to add  some data by "curl
>> http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml"
>> , or by "post.sh" in exampledocs folder ,
>> The same issue , the solr hang there , no result and not response .
>>
>> Can anybody give me some suggestions on how to debug solr to work with my
>> own custom analyzer ?
>>
>> By the way , I write a java program to call my custom analyzer , the
>> result is okay , for example , the following code can work well .
>> ==============
>> Analyzer analyzer = new MyAnalyzer() ;
>>
>> TokenStream ts = analyzer.tokenStream() ;
>>
>> CharTermAttribute ta = ts.getAttribute(CharTermAttribute.class);
>>
>> ts.reset();
>>
>> while (ts.incrementToken()){
>>
>> System.out.println(ta.toString());
>>
>> }
>>
>> =============
>>
>>
>> Thanks,
>>
>> -Mingz
>>
>
>


-- 
http://soleami.com/blog/automatically-acquiring-synonym-knowledge-from-wikipedia.html

Re: how to debug my own analyzer in solr

Posted by Siegfried Goeschl <sg...@gmx.at>.
Thread Dump and/or Remote Debugging?!

Cheers,

Siegfried Goeschl

On 21.10.13 11:58, Mingzhu Gao wrote:
> More information about this , the custom analyzer just implement
> "createComponents" of Analyzer.
>
> And my configure in schema.xml is just something like :
>
> <fieldType name="text_cn" class="solr.TextField" >
>   <analyzer class="my.package.CustomAnalyzer" />
> </fieldType>
>
>
>  From the log I cannot see any error information , however , when I want to
> analysis or add document data , it always hang there .
>
> Any way to debug or narrow down the problem ?
>
> Thanks in advance .
>
> -Mingz
>
> On 10/21/13 4:35 PM, "Mingzhu Gao" <mg...@adobe.com> wrote:
>
>> Dear solr expert ,
>>
>> I would like to write my own analyser ( Chinese analyser ) and integrate
>> them into solr as solr plugin .
>>
>>From the log information , the custom analyzer can be loaded into solr
>> successfully .  I define my <fieldType> with this custom analyzer.
>>
>> Now the problem is that ,  when I try this analyzer from
>> http://localhost:8983/solr/#/collection1/analysis , click the analysis ,
>> then choose my FieldType , then input some text .
>> After I click "Analyse Value" button , the solr hang there , I cannot get
>> any result or response in a few minutes.
>>
>> I also try to add  some data by "curl
>> http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml"
>> , or by "post.sh" in exampledocs folder ,
>> The same issue , the solr hang there , no result and not response .
>>
>> Can anybody give me some suggestions on how to debug solr to work with my
>> own custom analyzer ?
>>
>> By the way , I write a java program to call my custom analyzer , the
>> result is okay , for example , the following code can work well .
>> ==============
>> Analyzer analyzer = new MyAnalyzer() ;
>>
>> TokenStream ts = analyzer.tokenStream() ;
>>
>> CharTermAttribute ta = ts.getAttribute(CharTermAttribute.class);
>>
>> ts.reset();
>>
>> while (ts.incrementToken()){
>>
>> System.out.println(ta.toString());
>>
>> }
>>
>> =============
>>
>>
>> Thanks,
>>
>> -Mingz
>>
>


Re: how to debug my own analyzer in solr

Posted by Mingzhu Gao <mg...@adobe.com>.
More information about this , the custom analyzer just implement
"createComponents" of Analyzer.

And my configure in schema.xml is just something like :

<fieldType name="text_cn" class="solr.TextField" >
 <analyzer class="my.package.CustomAnalyzer" />
</fieldType>


>From the log I cannot see any error information , however , when I want to
analysis or add document data , it always hang there .

Any way to debug or narrow down the problem ?

Thanks in advance .

-Mingz

On 10/21/13 4:35 PM, "Mingzhu Gao" <mg...@adobe.com> wrote:

>Dear solr expert ,
>
>I would like to write my own analyser ( Chinese analyser ) and integrate
>them into solr as solr plugin .
>
>From the log information , the custom analyzer can be loaded into solr
>successfully .  I define my <fieldType> with this custom analyzer.
>
>Now the problem is that ,  when I try this analyzer from
>http://localhost:8983/solr/#/collection1/analysis , click the analysis ,
>then choose my FieldType , then input some text .
>After I click "Analyse Value" button , the solr hang there , I cannot get
>any result or response in a few minutes.
>
>I also try to add  some data by "curl
>http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml"
>, or by "post.sh" in exampledocs folder ,
>The same issue , the solr hang there , no result and not response .
>
>Can anybody give me some suggestions on how to debug solr to work with my
>own custom analyzer ?
>
>By the way , I write a java program to call my custom analyzer , the
>result is okay , for example , the following code can work well .
>==============
>Analyzer analyzer = new MyAnalyzer() ;
>
>TokenStream ts = analyzer.tokenStream() ;
>
>CharTermAttribute ta = ts.getAttribute(CharTermAttribute.class);
>
>ts.reset();
>
>while (ts.incrementToken()){
>
>System.out.println(ta.toString());
>
>}
>
>=============
>
>
>Thanks,
>
>-Mingz
>