lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geert-Jan Brits <gbr...@gmail.com>
Subject Re: posted query in forums as well as mailing list
Date Tue, 22 Jun 2010 14:09:29 GMT
Hi Barkha,

For these type of questions use:
solr-user@lucene.apache.org

You'll get better responses,

Geert-Jan


2010/6/22 barkha <barkha.jasani@silvertouch.com>

> Hello Guys,
>
> i'm a new bea to solr and i've been trying to achieve one of my
> requirements which is described as under.
>
> -> i've 2 tables in mysql db.i.e. (1) question_answer with fields
> id(PK),question,answer,notes etc in it
>                 (2) question_keywords with fields id(PK),question_id(FK
> that references PK i.e. id of question_answer),keyword(1 question_id can
> have multiple keywords),score etc
>
>
> -> Here i'm fetching the data from both the tables through solr and for
> that i did some changes in schema.xml,solr-config.xml and
> data-config.xml(that is referred by DataImportHandler specified in
> solr-config.xml) that lies under apache-solr-nightly/example/solr/conf
> directory.
>
>
> -> in solr-config.xml i've specified Data Import Handler with this way,
>
> <requestHandler name="/dataimport"
> class="org.apache.solr.handler.dataimport.DataImportHandler">
>   <lst name="defaults">
>     <str name="config">data-config.xml</str>
>   </lst>
>  </requestHandler>
>
> -> in data-config.xml i've specified,
>
>
> <dataConfig>
>   <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost/testdb" user="root" password=""/>
>   <document name="solrtest">
>       <entity name="question_answer" query="select * from question_answer">
>           <field column="id" name="id" />
>           <field column="question" name="question" />
>           <field column="answer" name="answer" />                   <entity
> name="question_keywords" query="select keyword, score from question_keywords
> where question_id='${question_answer.id}'">
>               <field name="keyword" column="keyword" />
>               <field name="score" column="score" />
>           </entity>
>       </entity>           </document>
> </dataConfig>
>
> -> in schema.xml,i've specified the following fields
>
>
> <fields>
>
>  <field name="id" type="string" indexed="true" stored="true"
> required="true" />
>  <field name="question" type="text" indexed="true" stored="true"
> required="true"/>
>  <field name="answer" type="text" indexed="true" stored="true"
> required="true" />
>  <field name="keyword" type="text" indexed="true" stored="true"
> required="true" />
>  <field name="score" type="integer" indexed="true" stored="true"
> required="true" />
>
>  </fields>
>
> <uniqueKey>id</uniqueKey>
> <defaultSearchField>keyword</defaultSearchField>
>
> <solrQueryParser defaultOperator="OR"/>
>
>
> -> Then i'm running start.jar given in example folder.and doing full-import
> by hitting this url,
> http://localhost:8983/solr/dataimport?command=full-import.
>
>
> -> Here my requirement is...
>
> i'm passing 1 question like "My baby has a nappy rash,what should I do?" in
> search query string by hitting this url :
> http://localhost:8983/solr/admin/ and pressing search button,
>
> Then solr parses the string and matching the key words in question_keywords
> table and returns all the keywords with the matching question_id present in
> question_answer as i kept by default search field as a keyword,i'm getting
> the result in xml format with this url,
> http://localhost:8983/solr/select/?q=My+baby+has+a+nappy+rash+what+should+I+do%3F&version=2.2&start=0&rows=10&indent=on
> .
>
> here the current scenario is like this,
>
> - if any 1 keyword matches with any of the keywords against question ids
> present in question_keywords and question_answer table,then it returns all
> the keywords that references the same id.so instead of fetching all the
> keywords i need to fetch the keywords that are matching with the question
> passed as a search query string with its score references the same keyword.
>
>
> -> and also i wanna do the sum of the score for the keywords that are
> fetched with different ids.and wanna return the result in form of
> question_id with the highest score among all the results(keywords with its
> score and question_id).
>
> so How can i do this?
>
> please somebody help as its too urgent,
>
> desperately waiting for any reply.
>
> Thanks,
> Barkha Jasani
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

Mime
View raw message