How can I search something using Solr? I have setup the Solr server in Apache and want to search in database (MySQL). I have indexed data successfully but don't know how to perform searching. Does anyone know about this?
Asked
Active
Viewed 672 times
2
-
4Did you go through this: http://lucene.apache.org/solr/tutorial.html ? – Alin Purcaru May 18 '11 at 13:40
-
Yes Alin, I went through that URL. But things are little bit different here, am integrating solr with appache tomcat not in jetty server.And now my problem is while making localhost:8080/solr/select/?q=";*" this request I am getting the response with the results, but when i use any data to be searched in that url it return like this
(for the URL localhost:8080/solr/select/?q=sofa) could you pls help me on this? – Nikhil Dinesh May 18 '11 at 14:28 -
you must put all details about your question in the question itself, not as comments. – Mauricio Scheffer May 18 '11 at 18:20
-
Ok Mauricio, I will do it in the future. Thanks. – Nikhil Dinesh May 19 '11 at 05:18
1 Answers
2
The easiest and fasted way (out of the box) to search, is the Solr Admin Interface. If your solr-instance is running on port 8080, so try the following:
http://localhost:8080/solr/admin/
Here you can insert the query. The result will be XML code.
If you wanna use solr into an application, so it depends on the programming language, how to realize an search. Finlay your objects/procedures/functions -what ever- will generate an solr URL where the search parameter are inside the url, like that:

The Bndr
- 13,204
- 16
- 68
- 107
-
ya....got it, while making http://localhost:8080/solr/select/?q="*" this request I am getting the response with the results, but when i use any data to be searched in that url it return like this
(for the URL http://localhost:8080/solr/select/?q=sofa) could you pls help me on this? – Nikhil Dinesh May 18 '11 at 14:07 -
and am facing one more problem I have 2 entities defined in the data-config.xml file, but am returning the result from the first entity only -- – Nikhil Dinesh May 18 '11 at 14:10
-
"
" maybe you are not searching into the right field? If you don't define the field where you like to search, (inside the url) solr searched inside the default search field. You have to define the field, where u like to search, change the default field or use "copy - fields" in solr to "copy" the indexed data from filed C, D or E into default-field A (for example) – The Bndr May 18 '11 at 14:29 -
Hi Bndr, I have added this into the schema.xml
anything else I need to do for getting a successful search result? pls help me. Thanks in Advance... – Nikhil Dinesh May 18 '11 at 14:42 -
1What to do depends on the field, where you search. So you have to define the search-field or you have to change the default search field or you have to use copyField to copy the informations from an non default-field into the default field -> http://stackoverflow.com/questions/4596075/how-to-use-solr-copyfield-directive – The Bndr May 19 '11 at 08:18
-
Thanks Bndr, Now I need to rank my search result, Is it possible with using solr? – Nikhil Dinesh May 30 '11 at 06:08
-
Yes, it it. You can rank the results by using the boost feature from solr/lucene, where you can define a boosting criteria - for example boosting by filed (example: date) (example sort by relevance and give special results an higher ranking, if there are new ones). An other feature is the elevation component. -> http://wiki.apache.org/solr/QueryElevationComponent – The Bndr May 30 '11 at 08:13
-
Hi Bndr, My req is something like this The results should be ranked based on a combination of the following factors: Frequency of matches amongst the data available. The products at the top should have attributes that match 100%. Tone of the reviews: if the user reviews tend to be more positive, Need to rank the products higher than a product that has the same attribute match % but a lower sentiment Results should also be re-ranked based on the click through rate of products. For example if on a given query, item in positio 3 gets constantly clicked first, then item 3 should rise in ranking – Nikhil Dinesh May 31 '11 at 10:00
-
I think I can do this by using the score field in solr, any one know how can I change the value of that score filed. Thanks in Advance – Nikhil Dinesh Jun 02 '11 at 05:53
-
probably you should start a new question related to your scoring issue. Many more people will red this, if it is a new question. – The Bndr Jun 14 '11 at 12:00
-
I too wanna ask it as a new question, but what to say, some how, they are no longer accepting my question. and now i got the solution for how to increase the scoring rate for a particular search. any way Thank you for your support... :-) – Nikhil Dinesh Jun 20 '11 at 07:23