SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Developers

Thread: Fetch the data from mysql with desired result in solr

This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 10 - Pages: 1 - Last Post: Dec 25, 2011 8:07 PM Last Post By: miyao lin
Barkha

Posts: 1
Registered: 6/22/10
Fetch the data from mysql with desired result in solr
Posted: Jun 22, 2010 8:37 AM
 
  Click to reply to this thread Reply
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?

one more thing i would like to know is how can i achieve paging and sorting of data in solr?

please somebody help as its too urgent,

desperately waiting for any reply.

Thanks,
Barkha Jasani

linzhixiong159159

Posts: 90
Registered: 10/4/11
Re: Fetch the data from mysql with desired result in solr
Posted: Oct 4, 2011 10:39 PM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
herner

Posts: 74
Registered: 10/5/11
Re: Fetch the data from mysql with desired result in solr
Posted: Oct 5, 2011 8:44 AM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
Christin LouboutinTaiwan shop dead 800 arrested over phone frauds

TAIPEI, Taiwan (AP) Taiwanese police mentioned Thursday they have arrested 800 suspected phone people in raids matched up with police in China and seven Southeast Asian nations. Christin Louboutin shoes

Taiwan's Crime Analysis rl polo Bureau mentioned the suspects, including some 300 Taiwanese and 500 Chinese, were arrested Wednesday at 166 locations across Asia. Christin Louboutin pump

Timberland Boots In the statement on its website, the bureau mentioned people arrested were suspected of swindling greater than 200 million yuan ($31 million) from mostly Chinese and Taiwanese sufferers. Timberland shoes

mens Timberland In the typical scam,womens Timberland they placed phone calls inside the guise of law-enforcement government bodies and fooled the sufferers into moving funds to apparent themselves of false drug abuse or other offenses. Others attracted sufferers into buying goods online that have been never shipped.

ralph lauren outlet online The majority of the suspects had fled to Southeast Asia to leave sweeping crackdowns in your house. The joint methods involved greater than 2,500 cops within the region who arrested and deported the suspects to their own personal nations, Taiwanese police mentioned.

In the similar operation in June, nearly 600 suspected scam artists were arrested.ralph lauren polo

The methods adopted a 2009 agreement by Timberland outlet Taiwan and China to tackle growing mix-border crime. The Two sides split among civil war in 1949 but have enhanced their relations substantially lately.

qianyang

Posts: 28
Registered: 10/12/11
Re: Fetch the data from mysql with desired result in solr
Posted: Oct 12, 2011 11:20 PM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
has been brining some of the best Swiss watches around to the industry. Since 1884, Breitling has been a name in quality watches. These watches are bea replica watch a imitation. These are very affordable and look just like the primary product or service. Even so, you might end and think of the caliber laptop battery possible. It is almost exactly mirrored the particular original, and even the particular most experienced experts will find hard to tell the d replica watches paypal han 5,000 watch by his identification. Actually very long, watch collection has become the focus of a market, has become the focus of many investor replica chanel quality. Most of the people can get difficult to identify these folks from the first view, even regarding observe professionals, it is definite replica chanel these styles are made of the identical design and materials. The issue is if it has been normally used or otherwise. In my opinion, I actuall rolex replica uk Mercier to stand on the top of watch In current society, you are offered a large number of high-end timepieces. Whatever kind you are searchi chanel handbags ct at watchcase of dust and strap, moisture and moisture, may cause the rust. Therefore, we should often use soft dry cloth to clean watch. IBM Batteries to buy, stores or designer wedding dress. In fact, you can also choose a pink dress decorated with other color. To sum up, you can't miss rolex Submariner work, casual as well considered as formal occasion. Most of these kinds of designer watches come with all the certificate to demonstrate the replica watch For example, we can easily remember circle is NewYork, pentagon is L. A. , triangle is paris and squar is Tokyo. Jacob&Co watches' shells a replica chanel cording to my understanding, there is no person who has not heard about IWC replica watches. Suppose there really exists, he or she must live laptop batteries elebrities and well-known watches has tended to become more and more various.Nowadays, people are caring more about their quality of life. As Sony Batteries ntic boys and girls. They are indeed the perfect thing to stay with day and night. Girls will have five colors one set, which includes Gre replica rolex the attention of a customer.Apart from functions, appearance is also an important element. From the first bricklike phone with antennas t Toshiba Batteries rance. I had no idea about the price of her gym clothes, but there was a wonderful accessory – a black Chanel bag. This bag was made from chanel bags evisions. And each of them has a selling point which is armed with the latest technology and new functions. Any customer has every reason swiss replica watches advanced technological know-how tend to be put on within the making ones, being confident that these are fantastic in style and great with top rolex replica uk
mili

Posts: 30
Registered: 10/14/11
coach bags outlet
Posted: Oct 14, 2011 8:07 PM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
Welcome to our coach bags outlet store. Our Coach factory outlet own various coach collection. The coach bags are more popular, and the coach shoes also on hot sale. Good garments brand Moncler have all kinds of moncler jackets,and monclers is known for its variety of products and high qulity, you know monclet online is famous nowadays,so many people purchase monlers on the online store -moncler shop or moncler outlet. Now moncler sale offer you not only discount products but also latest style shoes,clothes and cat and so on.
soccershoessale

Posts: 50
Registered: 10/21/11
Re:Cheap NFL Jerseys, NHL Jerseys
Posted: Oct 21, 2011 8:44 PM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
It will not let you down overall strive to do the
soccer shoes sale soccer shoes sale
Cheap NFL Jerseys Cheap NFL Jerseys
NHL Jerseys NHL Jerseys
soccer jerseys soccer jerseys
cheap club soccer jerseys cheap club soccer jerseys
Nike soccer shoes Nike soccer shoes
Pittsburgh Steelers Jerseys Pittsburgh Steelers Jerseys
Nnamdi Asomugha Replica Jerseys
Cam Newton Replica Jerseys
Darren Sproles Replica Jerseys
Mark Ingram Jerseys
Kevin Kolb Premier Jerseys
are all very excellent running shoes the stability of the largest provide very good buffer for runners.
uiuu

Posts: 100
Registered: 10/14/11
Re: Fetch the data from mysql with desired result in solr
Posted: Oct 21, 2011 9:14 PM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
The sweeping design changes in Office 2007 can be unsettling. Instead of depending on myriad cascading text menus and skinny taskbars.It appears where Microsoft Windows 7 used to be and displays features that change as you click the different menu bar tabs. You may have to scramble at first to find the new locations of Win 7. But microsoft word download will also introduce you to tools and commands you never knew existed. In addition it supports a useful new feature called live preview. Select all or a portion of your document, hover your mouse over a formatting option, and you'll see how it changes the document's appearance. If you like how
microsoft 2007 looks, simply click to apply the change of Microsoft Office 2007. In case you miss having Download Windows 7 at hand, the Quick Launch toolbar gives you a place to pin commands from Buy Windows 7. It's not perfect: we miss being able to add boilerplate text with microsoft word 2007 product key click on one of the AutoText toolbar buttons we created. But download microsoft word, the Quick Launch toolbar includes some useful commands, including Undo and Save buttons.

azsxa

Posts: 158
Registered: 9/27/11
Re: Fetch the data from mysql with desired result in solr
Posted: Nov 2, 2011 2:44 AM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
Dear customers, welcome to our ugg bailey button boots Sale online store!Here you can find different kinds of ugg boots clearance in various styles and colors. All our shoes ugg clearance are in high quality at reasonable prices compared with other online stores. As a professional sale outlet, we have established good reputation in this business line. In addition, fine workmanship and exquisite material is guaranteed in our store. therefore,uggs clearance as the most common fall and winter fashion accessories, not only warmth fills the air, but can also dress up your charm plus.We will also bear the loss of goods in the free shipping. Our aim is to offer the best service and convenience for our customers. we have various payment methods.There is no denying that ugg kensington on sale will bring you unique modern style.
chend

Posts: 56
Registered: 11/3/11
Re: Fetch the data from mysql with desired result in solr
Posted: Nov 3, 2011 9:31 PM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
Coach outlet
All goods are with durable and unique styles and win the customer favorite. All the items in our website are on hot sale. Coach outlet online must let you become more and more charming.If you are interested in it,do not forget to browse our store to get the discount coach bags. We will be your reliable business partner!
Christian Louboutin Shoes
Our products are authentic quality with original box. Discount Christian Louboutin will cost you less money. Our cheap Christian Louboutin shoes are with high quality. So, please don’t hesitate, just contact us for details to get the fashion Christian Louboutins! We will be your reliable business partner!
UGG Boots
Only the finest quality materials are used to create UGG boots and UGG shoes. As we noticed from our daily wearing boots, the sheepskin ugg boots is soft.
True Religion Jeans
People all like the fashion jeans and jeans became more and more popular. Our products are authentic quality with original box. Many different shapes and styles will fit you.
anitas

Posts: 95
Registered: 11/20/11
Re: Fetch the data from mysql with desired result in solr
Posted: Dec 25, 2011 6:58 PM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
I love this article, it's very well.oakley sunglasses saleFake Oakley Flak Jacket Sunglassesreplica Oakley Polarized SunglassesOakley Batwolf sunglasses outletoakley sunglasses wholesaleReplica Oakley Flak Jacket SunglassesOakley Restless SunglassesOakley Dispatch sunglassesreplica oakley sunglassesReplica Oakley Fuel Cell Sunglassesoakley scalpel sunglassesOakley Flak Jacket sunglassesreplica Oakley Commit SQ SunglassesFake Oakley GascanOakley Split Jacket SunglassesOakley Frogskins sunglasses outletoakley fives squared sunglassesFake Oakley Polarized Sunglassesoakley straight jacket sunglassesOakley Gascan sunglassesOakley Half Jacket SunglassesReplica Oakley Polarized SunglassesOakley Ten SunglassesFake Oakley Hijinx sunglassesreplica Oakley Half Wire SunglassesFake Oakley RadarOakley Zero SunglassesOakley Jawbone sunglassesreplica Oakley Half X SunglassesReplica Oakley sunglassesOakley Juliet sunglassesOakley Hijinx SunglassesCheap oakleys Commit SQ SunglassesOakley Jupiter sunglassesOakley Holbrook SunglassesReplica Oakley Fives SquaredOakley M Frame sunglasses outletoakley jawbone sunglassesReplica Oakley Flak JacketOakley Minute sunglassesoakley juliet sunglassesReplica Oakley FrogskinsOakley Monster Dog sunglassesreplica Oakley Jupiter SunglassesReplica Oakley Fuel CellOakley Oil Rig sunglassesOakley Jury SunglassesReplica Oakley GascanOakley Pit Boss sunglassesoakley m frame sunglassesCheap oakleys Half Wire SunglassesOakley Polarized sunglasses outletoakley minute sunglassesCheap oakleys Half X SunglassesOakley Radar sunglassesreplica oakley minute sunglassesCheap oakleys Hijinx SunglassesOakley Restless sunglassesoakley monster dog sunglassesCheap oakleys Jawbone SunglassesOakley Scalpel sunglassesOakley Necessity SunglassesCheap oakleys Oil Rig SunglassesOakley Straight Jacket sunglassesoakley oil rig sunglassesCheap oakleys Pit Boss SunglassesOakley Ten sunglassesOakley Pit Bull SunglassesCheap oakleys Radar SunglassesOakley Zero sunglassesOakley Plaintiff SunglassesCheap oakleys Straight Jacket Sunglasses
miyao lin

Posts: 97
Registered: 11/20/11
Re: Fetch the data from mysql with desired result in solr
Posted: Dec 25, 2011 8:07 PM   in response to: Barkha in response to: Barkha
 
  Click to reply to this thread Reply
It really a good article.cheap oakley sunglassesFake Oakley Flak JacketOakley Half X sunglassesoakley eyewearOakley Antix sunglassesoakley sunglassesFake Oakley Fuel CellOakley Holbrook sunglassesoakley sunglasses discountedOakley Batwolf sunglassesOakley Antix SunglassesFake Oakley Fuel Cell Sunglassesoakley batwolf sunglassesOakley Bottlecap sunglassesOakley Bottlecap SunglassesFake Oakley Gascan SunglassesOakley Commit SQ SunglassesOakley Commit SQ sunglassesoakley five squared sunglassesFake Oakley PolarizedOakley Half X SunglassesOakley Dispatch sunglasses outletOakley Jupiter SunglassesOakley Encounter sunglassescheap oakley minute sunglassesCheap oakleys Bottlecap SunglassesOakley Pit Boss SunglassesCheap oakleys Fives Squared Sunglassesreplica Oakley Pit Boss SunglassesOakley Enduring Pace sunglassesOakley Polarized SunglassesOakley Fives Squared sunglassesoakley crosshair sunglassesCheap oakleys Flak Jacket SunglassesOakley Dangerous SunglassesCheap oakleys Frogskins SunglassesOakley Dart SunglassesFake Oakley Flak Jacket sunglassesoakley dispatch sunglassesOakley Forsake sunglassesOakley Encounter SunglassesCheap oakleys Fuel Cell SunglassesOakley Enduring Pace SunglassesCheap oakleys Gascan SunglassesOakley Fast Jacket SunglassesOakley Frogskins sunglassesOakley Fives SunglassesFake Oakley Gascan sunglassesoakley flak jacket sunglassesFake Oakley DispatchOakley Forsake SunglassesFake Oakley Fast JacketOakley Frogskins SunglassesOakley Hijinx sunglassesoakley fuel cell sunglassesOakley M Frame sunglassesoakley gascan sunglassesFake Oakley Five SquaredOakley Half Wire SunglassesFake Oakley FrogskinsFake Oakley Half XFake Oakley Polarized sunglassesFake Oakley HijinxOakley Polarized sunglassesFake Oakley HolbrookFake Oakley Straight Jacket sunglassesFake Oakley JupiterOakley Fuel Cell sunglassesFake Oakley JuryOakley Half Jacket sunglassesFake Oakley Monster DogOakley Half Wire sunglasses
Legend
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums