Plugging a solr index into django app using haystack - solr

I have some data in a mysql database and its indexed through the solr admin app. I want to expose this data as facets in a django app. I explored ajax solr and it seems to be a very good solution for integrating solr into a web app with faceting, tags etc. I was also evaluating haystack to see if that would provide a much better solution.
Is there a way to integrate existing solr index with haystack ? It looks like we need to create a model and populate the model and solr would index the model. But in my case, I already have the index built and just want to integrate into django through haystack. would appreciate any thoughts regarding this
thanks
Joe.

Related

how to communicate with solr while searching?

I am learning how to develop a search application using solr.I have a website created using html where it has a search bar.
when the user enters a keywords to be searched it has to retrieve the matched records from data indexed into solr. my question is how to connect frontend
website with solr.
Please give me clear steps to implement the same.
There are different library for communication with solr, you can use depends on your technologies. some are ::
Solarium [PHP] :
Solarium is a PHP Solr client library that accurately model Solr concepts. Where many other Solr libraries only handle the communication with Solr, Solarium also relieves you of handling all the complex Solr query parameters using a well documented API.
https://github.com/solariumphp/solarium
Haystack [Django] :
Haystack provides modular search for Django. It features a unified, familiar API that allows you to plug in different search backends (such as Solr, Elasticsearch, Whoosh, Xapian, etc.) without having to modify your code.
https://django-haystack.readthedocs.io/en/master/
If you are using JavaScript you could use the Sorl REST API directly from the client.
There are various client APIs:
https://lucene.apache.org/solr/guide/6_6/client-apis.html

How the Apache Solr server is connecting to drupal db

Firstly Thanks to stackoverflow which is giving support to everyone.
Iam new to drupal and solr server
I have Successfully installed the solrserver in my system and I can able to search the data using "Apache Solr search module" In drupal7.
But Actually I dont know what is the Background process that is Running.But Inorder to have work with it I need to have a ground knowledge on it.Drupal is connecting to solr server using the url which I have Provided in admin UI.
As Per My knowledge I think the following is the backend flow of Apache solr server module
1)It sends the request of search string from drupal to solr server.
2)The solr server searches for the string and send the result back in the format of json to drupal.
3)Drupal displays the results
But How the solr server connects to drupal db inorder to search for the string or content?
Please help with this..I really In a need to know the backend flow how the request is handling
Thankyou
I'm not a Drupal specialist, but from the Solr prospective you are searching on the documents previously indexed on Solr. I.e., all documents must be indexed on Solr prior to the search.
Therefore, you have 2 ways here:
You call Solr API from your backend and push documents to Solr index. There are specific drupal solutions you may research, but here is the wiki article from Solr prospective describing how to index documents using only JSON API: http://wiki.apache.org/solr/UpdateJSON
You connect to your database directly from Solr and pull documents to Solr index. Here is the related wiki page: http://wiki.apache.org/solr/DataImportHandler

How to search for key words using Solr from crawled web pages by nutch?

I have an application which crawls over the websites using Apache Nutch 2.1 and persisting data to the MySQL. I have to integrate Nutch and Solr which is not a problem as enough documentation is available on the internet.
After storing content from webpages, i want to add a search functionality based on Solr. I need to search for key words in the webpages. For example, if i am crawling websites which are movies related and i want to search for any specific movie(as a key word) from the crawled data, what are the changes i need to make to the Solr configurations. Do i need to write a separate plugin altogether or i can use existing plugins?What type of indexing i have to add to the solr configurations?

solr faceted search UI development

I am working on a POC, where I have to display faceted search result on web page. can anybody please help me to suggest what all set up I need to configure to display. I would prefer java technologies. Just to mention, I have solr cloud running on remote server.
I would like to know:
1. Should I use MVC framework?
2. How will my local interact with remote solr server?
3. How will I send query through java code and what technology I should use to display faceted search result?
or any example how someone is doing will be very helpful.
Please help me on this.
Thanks,
One of the quickest ways to create your POC is by using the VelocityResponseWriter, this response writter is bundled in Solr distribution, it's basically a series of Apache Velocity templates that are very easy to customize.

security threats in exposing solr query to customers in live website

I am going to build a website and I am planning to use solr for search integration.It is a ecommerce web site. I wanted to know if there is any problem in exposing the solr query format to the users of this website?
You want to have your search app query Solr, or use a proxy, so the URL is not exposed to the web user. I'm not so concerned about query syntax and parameters being visible, as long as the web user can't send them via query. You for certain want to make sure only the web app can reach the Solr server, however.
Even if you lock down the RequestHandlers so that only searches are available through the web, there still may be things in your index that you don't want to expose to customers.
For example, if two items score the same in a search, you'd like to boost the one with the higher margin. In order to do that you need to have the margin in your index, and that means it's available for all of your customers and competitors to see.
The JSON response writer is very handy for writing lightweight search apps. At the very least you'll want to implement a filtering proxy between the browser and Solr.
You absolutely do not want to expose Solr directly to users. Nor do you want to pass the format through without evaluation.
One of the thing that Solr supports is delete by query. There are other possibilities as well. You have to sanitize the content of queries.

Resources