{"id":73,"date":"2010-09-06T14:10:35","date_gmt":"2010-09-06T12:10:35","guid":{"rendered":"http:\/\/sematext.solr.pl\/?p=73"},"modified":"2020-11-10T14:12:30","modified_gmt":"2020-11-10T13:12:30","slug":"solr-data-indexing-for-fun-and-profit","status":"publish","type":"post","link":"https:\/\/solr.pl\/en\/2010\/09\/06\/solr-data-indexing-for-fun-and-profit\/","title":{"rendered":"Solr: data indexing for fun and profit"},"content":{"rendered":"<p>Solr is not very friendly to novice users. Preparing good schema file requires some experience. Assuming that we have prepared the configuration files, what remains for us is to share our data with the search server and take care of update ability.<\/p>\n\n\n<!--more-->\n\n\n<p>There are a few ways to import data:<\/p>\n<ul>\n<li> Update Handler<\/li>\n<li>Cvs Request Handler<\/li>\n<li>Data Import Handler<\/li>\n<li>Extracting Request Handler (Solr Cell)<\/li>\n<li>Client libraries (for example Solrj)<\/li>\n<li>Apache Connector Framework (formerly Lucene Connector Framework)<\/li>\n<li>Apache Nutch<\/li>\n<\/ul>\n<p>In addition to the mentioned above you casn stream your data to search server.  As you can see, there is some confusion here and its to provide the best method to use in a particular case at first glance.<\/p>\n<h2>Update Handler<\/h2>\n<p>Perhaps the most popular method because of simplicity. It requires the preparation of the corresponding XML file and then You must send it via HTTP to a Solr server. It enables document and individual fields boosting.<\/p>\n<h2>CSV Request Handler<\/h2>\n<p>When we have data in CSV format (Coma Separated Values) or in TSV format (Tab Separated Values) this option may be most convenient. Unfortunately, in contrast to the Update Handler is not possible to boost documents or fields.<\/p>\n<h2>Data Import Handler<\/h2>\n<p>This method is less common, requires additional and sometimes quite complicated configuration, but allows direct linking to the data source. Using DIH we do not need any additional scripts for data exporting from a source to the format required by Solr. What we get out of the box is: integration with databases (based on JDBC),  integration with sources available in XML (for example RSS), e-mail integration (via IMAP protocol) and integration with documents which can be parsed by Apache Tika (like OpenOffice documents, Microsoft Word, RTF, HTML, and many, many more).   In addition it is possible to develop your own sources and transformations.<\/p>\n<h2>Extracting Request Handler (Solre Cell)<\/h2>\n<p>Specialized handler for indexing the content of documents stored in files of different formats. List of supported formats is quite extensive and the indexing is performed by Apache Tika.  The drawback of this method is the need of building additional solutions that provide Solr  the information about the document and its identifier and that there is  no support for providing additional meta data, external to the  document.<\/p>\n<h2>Client Libraries<\/h2>\n<p>Solr provides client libraries for many programming languages. Their capabilities differ, but if the data are generated onboard  by the application and the time after in which the data must be  available for searching is very low, this way of indexing is often the  only available option.<\/p>\n<h2>Apache Connector Framework<\/h2>\n<p>ACF is a relatively new project, which revealed a wider audience in early 2010. The project was initially an internal project run by the company MetaCarta, and was donated to the open source community and is currently being developed within Apache incubator. The idea is to build a system that allows making connection to the data source with a help of a series of plug-ins. At  the moment there is no published version, but the system itself is  already worth of interest in the case of the need to integrate with such  systems as: FileNet P8 (IBM), Documentum (EMC), LiveLink (OpenText), Patriarch (Memex), Meridio (Autonomy) Windows shares (Microsoft) and SharePoint (Microsoft).<\/p>\n<h2>Apache Nutch<\/h2>\n<p>Nutch is in fact, a separate project run by the Apache (previously under the Apache Lucene, now a top level project). For the person using Solr Nutch is interesting as it allows to crawl through Web pages and index them by Solr.<\/p>\n<h2>Word about streaming<\/h2>\n<p>Streaming means the ability to notice Solr, where to download the data to be indexed. This avoids unnecessary data transmission over the network, if the data is on the same server as indexer, or double data transmission (from the source to the importer and from the importer to Solr).<\/p>\n<h2>And a word about security<\/h2>\n<p>Solr, bye design, is intended to be used in a architecture assuming safe environment. It is very important to note, who and how is able to query solr. While  the returned data can be easily reduced, by forcing the use of filters  in the definition of the handler, then in the case of indexing is not so  easy. In particular, the most dangerous seems to be Solr Cell &#8211; it will not only allow to read any file to which Solr have access(eg. files with passwords), but will also will provide a convenient method of searching in those files \ud83d\ude09<\/p>\n<h2>Other options<\/h2>\n<p>I tried to mention all the methods that does not require any additional work to make indexing work. The  problem may be the definition of this additional work, because  sometimes it is easier to write additional plug-in than break through  numerous configuration options and create a giant XML file. Therefore,  the choice of methods was guided by my own sense, which resulted in  skipping of some methods (like fetching data from WWW pages with the use  of Apache Droids or Heritrix, or solutionsa based on Open Pipeline or Open Pipe).<\/p>\n<p>Certainly in this short article I managed to miss some interesting methods. If so, please comment, I`ll be glad update this entry \ud83d\ude42<\/p>","protected":false},"excerpt":{"rendered":"<p>Solr is not very friendly to novice users. Preparing good schema file requires some experience. Assuming that we have prepared the configuration files, what remains for us is to share our data with the search server and take care of<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[27],"tags":[202,205,204,196,203,206],"class_list":["post-73","post","type-post","status-publish","format-standard","hentry","category-solr-en","tag-acf-2","tag-cell-2","tag-import-2","tag-indexing-2","tag-lcf-2","tag-tika-2"],"_links":{"self":[{"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/posts\/73","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":1,"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/posts\/73\/revisions\/74"}],"wp:attachment":[{"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solr.pl\/en\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}