Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can manipulate Solr using the SolrJ API. </p> <p>Here's the API documentation: <a href="http://lucene.apache.org/solr/4_0_0/solr-solrj/index.html" rel="nofollow noreferrer">http://lucene.apache.org/solr/4_0_0/solr-solrj/index.html</a></p> <p>And here's a article on how to use SolrJ to index files on your harddrive.<br> <a href="http://blog.cloudera.com/blog/2012/03/indexing-files-via-solr-and-java-mapreduce/" rel="nofollow noreferrer">http://blog.cloudera.com/blog/2012/03/indexing-files-via-solr-and-java-mapreduce/</a></p> <p>Files are represented by <code>InputDocument</code> and you use <code>.addField</code> to attach fields that you'd like to search on at a later time. </p> <p>Here's example code for an Index Driver:</p> <pre><code>public class IndexDriver extends Configured implements Tool { public static void main(String[] args) throws Exception { //TODO: Add some checks here to validate the input path int exitCode = ToolRunner.run(new Configuration(), new IndexDriver(), args); System.exit(exitCode); } @Override public int run(String[] args) throws Exception { JobConf conf = new JobConf(getConf(), IndexDriver.class); conf.setJobName("Index Builder - Adam S @ Cloudera"); conf.setSpeculativeExecution(false); // Set Input and Output paths FileInputFormat.setInputPaths(conf, new Path(args[0].toString())); FileOutputFormat.setOutputPath(conf, new Path(args[1].toString())); // Use TextInputFormat conf.setInputFormat(TextInputFormat.class); // Mapper has no output conf.setMapperClass(IndexMapper.class); conf.setMapOutputKeyClass(NullWritable.class); conf.setMapOutputValueClass(NullWritable.class); conf.setNumReduceTasks(0); JobClient.runJob(conf); return 0; } } </code></pre> <p>Read the <a href="http://blog.cloudera.com/blog/2012/03/indexing-files-via-solr-and-java-mapreduce/" rel="nofollow noreferrer">article</a> for more info. </p> <p><strong>Compressed files</strong> Here's info on handling compressed files: <a href="https://stackoverflow.com/questions/4017200/using-solr-cells-extractingrequesthandler-to-index-extract-files-from-package-f">Using Solr CELL&#39;s ExtractingRequestHandler to index/extract files from package formats</a> </p> <p>There seems to be some bug with Solr not handling zip files, here's the bugreport with a fix: <a href="https://issues.apache.org/jira/browse/SOLR-2416" rel="nofollow noreferrer">https://issues.apache.org/jira/browse/SOLR-2416</a> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload