Search code examples
solrsolrjsolr-query-syntax

Setting up Solr and Querying it


I am new to Solr.

  1. I am not able to find out a proper document which could help me understand what all do I need to add in the solrconfig.xml and what is to be removed.

  2. My SolrDocument would contain id, field1, field2. Out of the 2 fields, I want to update 1 of them. How do I do? I tried a few things but it overwrites the entire document.

  3. /update is not working.

I have to add documents and retrieve them from inside a Java class.


Solution

    1. You can refer to Solr Wiki for Solr Config.xml it is a good starting point to understand the configuration options.

    2. Solr does not really have an update concept, it always deletes the existing document and replaces it with new document. There is a feature request open years back JIRA-139 to address this problem, but as of today it shows the fix version to be 4.1. But Solr 4.0 has a new feature Atomic update that you could try, if this is something very critical for you. Note: Solr 4.0 is still a Beta.

    3. '/update' not working -> do you mean not working since it is replacing the old document with new document or do you get error/exception ?

    4. To add & retrieve documents from Java, you can use SolrJ. SolrJ is Java client to access Solr programmatically. SolrJ - Solr Wiki.