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 mirage1987 <mi...@gmail.com> on 2009/04/14 13:51:42 UTC

Customizing solr with my lucene

hey,
      I am trying to modify the lucene code by adding payload functionality
into it.
Now if i want to use this lucene with solr what should i do.
I have added this to the lib folder of solr.war replacing the old lucene..Is
this enough??
Plus i am also using a different schema than the default shema.xml used by
solr.(Added some fields and removed some of the previous ones).
The problem i am facing is that now the solr is not returning results but
the lucene individually is for the same query.
Could you help me on this...ny ideas n suggestions??
-- 
View this message in context: http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23038007.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customizing solr with my lucene

Posted by mirage1987 <mi...@gmail.com>.
Hi,
     Well let me exaplin the scenario in detail.
I have my lucene.jar that i need to work with Solr. So i started by adding
the lucene.jar to the WEB_INF directory of solr.war,added my schema.xml in
conf dir and restarted the solr server.
Now i run my program , add a doc into it. The doc is added successfully as
shown by the stats. But when i query it through the browser no results are
returned. I tried out with various terms in *:* shows the doc. 
Am i missing sumthin here. Is there a way i can view the posting list of the
solr (lucene) and see weather my terms has been indexed or not.

So let's say my doc has an entry like
<name>University of Southern California</name>
and i search for "california" no results from solr
But wen i do it on my lucene without solr results are shown.

I also tried the debug query into my queries as u suggested.
Here is what i get....This is very much the way i have modified my lucene so
query parsing seems correct
<response>
−
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
−
<lst name="params">
<str name="debugQuery">true</str>
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">name:california </str>
<str name="rows">10</str>
<str name="version">2.2</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
−
<lst name="debug">
<str name="rawquerystring">name:california </str>
<str name="querystring">name:california </str>
<str name="parsedquery">BoostingTermQuery(value:california)</str>
<str name="parsedquery_toString">value:california</str>
<lst name="explain"/>
<str name="QParser">OldLuceneQParser</str>
−
<lst name="timing">
<double name="time">0.0</double>
−
<lst name="prepare">
<double name="time">0.0</double>
−
<lst name="org.apache.solr.handler.component.QueryComponent">
<double name="time">0.0</double>
</lst>
−
<lst name="org.apache.solr.handler.component.FacetComponent">
<double name="time">0.0</double>
</lst>
−
<lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
<double name="time">0.0</double>
</lst>
−
<lst name="org.apache.solr.handler.component.HighlightComponent">
<double name="time">0.0</double>
</lst>
−
<lst name="org.apache.solr.handler.component.DebugComponent">
<double name="time">0.0</double>
</lst>
</lst>
−
<lst name="process">
<double name="time">0.0</double>
−
<lst name="org.apache.solr.handler.component.QueryComponent">
<double name="time">0.0</double>
</lst>
−
<lst name="org.apache.solr.handler.component.FacetComponent">
<double name="time">0.0</double>
</lst>
−
<lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
<double name="time">0.0</double>
</lst>
−
<lst name="org.apache.solr.handler.component.HighlightComponent">
<double name="time">0.0</double>
</lst>
−
<lst name="org.apache.solr.handler.component.DebugComponent">
<double name="time">0.0</double>
</lst>
</lst>
</lst>
</lst>
</response>








Erik Hatcher wrote:
> 
> What is the query parsed to?   Add &debugQuery=true to your Solr  
> request and let us know what the query parses to.
> 
> As for whether upgrading a Lucene library is sufficient... depends on  
> what Solr version you're starting with (payload support is already in  
> all recent versions of Solr's Lucene JARs) and what has changed in  
> Lucene since, and whether you're expecting an existing index to work  
> or rebuilding it from scratch.
> 
> 	Erik
> 
> On Apr 14, 2009, at 7:51 AM, mirage1987 wrote:
> 
>>
>> hey,
>>      I am trying to modify the lucene code by adding payload  
>> functionality
>> into it.
>> Now if i want to use this lucene with solr what should i do.
>> I have added this to the lib folder of solr.war replacing the old  
>> lucene..Is
>> this enough??
>> Plus i am also using a different schema than the default shema.xml  
>> used by
>> solr.(Added some fields and removed some of the previous ones).
>> The problem i am facing is that now the solr is not returning  
>> results but
>> the lucene individually is for the same query.
>> Could you help me on this...ny ideas n suggestions??
>> -- 
>> View this message in context:
>> http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23038007.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23096895.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customizing solr with my lucene

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
What is the query parsed to?   Add &debugQuery=true to your Solr  
request and let us know what the query parses to.

As for whether upgrading a Lucene library is sufficient... depends on  
what Solr version you're starting with (payload support is already in  
all recent versions of Solr's Lucene JARs) and what has changed in  
Lucene since, and whether you're expecting an existing index to work  
or rebuilding it from scratch.

	Erik

On Apr 14, 2009, at 7:51 AM, mirage1987 wrote:

>
> hey,
>      I am trying to modify the lucene code by adding payload  
> functionality
> into it.
> Now if i want to use this lucene with solr what should i do.
> I have added this to the lib folder of solr.war replacing the old  
> lucene..Is
> this enough??
> Plus i am also using a different schema than the default shema.xml  
> used by
> solr.(Added some fields and removed some of the previous ones).
> The problem i am facing is that now the solr is not returning  
> results but
> the lucene individually is for the same query.
> Could you help me on this...ny ideas n suggestions??
> -- 
> View this message in context: http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23038007.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customizing solr with my lucene

Posted by mirage1987 <mi...@gmail.com>.
Well guys the problem is now solved and evrythin's working perfectly fine.:-)
Thankyou all for your help.
The problem was indeed with the config files (schema and solrconfig). I
rewrote my files from scratch and now everythin's seems to be working. The
debug query option was quite helpful in making me understand solr works and
help me made the required changes to my lucene code and api.



-- 
View this message in context: http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23181503.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customizing solr with my lucene

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
I'm not sure what is going on.  I don't quite understand what you're  
doing to Lucene that requires replacing the JAR file, but of course  
that is quite a red flag for why things aren't working.  Of course  
there is a concern of index compatibility, so be sure you're starting  
with no index and reindexing from scratch when trying a different  
Lucene build inside Solr, and you have to know what you're doing with  
solr.war manipulation to ensure you've got the right version there.   
And there may be dependencies on the other Lucene related JARs like  
all the contribs, so you might need to replace those in lock step  
fashion also.

	Erik

On Apr 17, 2009, at 10:26 AM, mirage1987 wrote:

>
> Hey Erik,
>             I also checked the index using luke and the index shows  
> that
> the terms are indexed as they should have been. So that implies that
> something is wrong with the querying only and the results are not  
> getting
> retrieved.(As i said earlier even the parsed query is the way it  
> should be
> according to the changes i have made to lucene.)
> Any ideas you have on this. Why this could be happening.
>
> One more thing... tried to query the solr index using luke ...but  
> still no
> results....may be the index is not stored correctly....could it be  
> changes
> in the lucene api???....should i revert to an older version of solr???
>
>
>
> -- 
> View this message in context: http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23098700.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customizing solr with my lucene

Posted by mirage1987 <mi...@gmail.com>.
Hi,
    Here's the schema.xml i am using.

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="myschema" version="1.1">
  <types>
	<fieldType name="string" class="solr.StrField" sortMissingLast="true"
omitNorms="true"/>
	<fieldType name="text" class="solr.TextField" positionIncrementGap="100"/>
  </types>
  <fields>
   	<field name="id" type="string" indexed="true" stored="true"
required="true" multiValued="true" /> 
   	<field name="name" type="text" indexed="true" stored="true"
multiValued="true" /> 
   	<field name="value" type="text" indexed="true" stored="true"
multiValued="true" />
   	<dynamicField name="*" type="text" indexed="true"  stored="true"/>
  </fields>

 <uniqueKey>id</uniqueKey>

 <defaultSearchField>value</defaultSearchField>

 <solrQueryParser defaultOperator="OR"/>  
 
 <similarity class="org.apache.lucene.search.DefaultSimilarity"/>
 
</schema>

I can't figure out the error. Do u see any probs with the current schema.
The schema is defined as such because i have implemented the my own analyzer
an tokenizer into the 
lucene index writer. So if solr calls the index writer then there should be
no prob.Similarly i have made my changes to the lucene query parser so i
want the default lucene query handling.
So basically i intend to use the solr just to directly call my lucene.
Is it possible or would i have to change the solr code??

One more prob i faced. I want to use dynamic fields="*" but it doesn't seem
to work.
As when i remove fieldName="name" from the above list no content error is
reported (as my input file has name fields and dynamic field doesn't seem to
catch it)

Any ideas on this.

Thanx.



Allahbaksh Asadullah-2 wrote:
> 
> Just check your schema.xmlRegards,
> Allahbaksh
> 
> On Fri, Apr 17, 2009 at 7:56 PM, mirage1987 <mi...@gmail.com> wrote:
> 
>>
>> Hey Erik,
>>             I also checked the index using luke and the index shows that
>> the terms are indexed as they should have been. So that implies that
>> something is wrong with the querying only and the results are not getting
>> retrieved.(As i said earlier even the parsed query is the way it should
>> be
>> according to the changes i have made to lucene.)
>> Any ideas you have on this. Why this could be happening.
>>
>> One more thing... tried to query the solr index using luke ...but still
>> no
>> results....may be the index is not stored correctly....could it be
>> changes
>> in the lucene api???....should i revert to an older version of solr???
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23098700.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Allahbaksh Mohammedali Asadullah,
> Software Engineering & Technology Labs,
> Infosys Technolgies Limited, Electronic City,
> Hosur Road, Bangalore 560 100, India.
> (Board: 91-80-28520261 | Extn: 73927 | Direct: 41173927.
> Fax: 91-80-28520362 | Mobile: 91-9845505322.
> 
> 

-- 
View this message in context: http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23133779.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customizing solr with my lucene

Posted by Allahbaksh Asadullah <al...@gmail.com>.
Just check your schema.xmlRegards,
Allahbaksh

On Fri, Apr 17, 2009 at 7:56 PM, mirage1987 <mi...@gmail.com> wrote:

>
> Hey Erik,
>             I also checked the index using luke and the index shows that
> the terms are indexed as they should have been. So that implies that
> something is wrong with the querying only and the results are not getting
> retrieved.(As i said earlier even the parsed query is the way it should be
> according to the changes i have made to lucene.)
> Any ideas you have on this. Why this could be happening.
>
> One more thing... tried to query the solr index using luke ...but still no
> results....may be the index is not stored correctly....could it be changes
> in the lucene api???....should i revert to an older version of solr???
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23098700.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>


-- 
Allahbaksh Mohammedali Asadullah,
Software Engineering & Technology Labs,
Infosys Technolgies Limited, Electronic City,
Hosur Road, Bangalore 560 100, India.
(Board: 91-80-28520261 | Extn: 73927 | Direct: 41173927.
Fax: 91-80-28520362 | Mobile: 91-9845505322.

Re: Customizing solr with my lucene

Posted by mirage1987 <mi...@gmail.com>.
Hey Erik,
             I also checked the index using luke and the index shows that
the terms are indexed as they should have been. So that implies that
something is wrong with the querying only and the results are not getting
retrieved.(As i said earlier even the parsed query is the way it should be
according to the changes i have made to lucene.)
Any ideas you have on this. Why this could be happening.

One more thing... tried to query the solr index using luke ...but still no
results....may be the index is not stored correctly....could it be changes
in the lucene api???....should i revert to an older version of solr???



-- 
View this message in context: http://www.nabble.com/Customizing-solr-with-my-lucene-tp23038007p23098700.html
Sent from the Solr - User mailing list archive at Nabble.com.