Search code examples
solrsolr4solrcloud

Custom Solr Full Import


I have a solr core core1, which has a couple of Facet Types and I want to implement a custom Import for them. For eg: I have the Following Facet Types:

  • Facet1
  • Facet2
  • Facet3

When I use the Data Import Handler, I don't want to do the "delta" for business reasons, and I just want to do a clean / Full-Import for Facet1 and Facet2 and leave alone Facet3. Is this possible in Solr?

Any help / direction is appreciated.


Solution

  • You could use an approach similar to the one mentioned at http://wiki.apache.org/solr/DataImportHandlerDeltaQueryViaFullImport.

    Your query in data-config.xml will then be

    <entity ...
        query="SELECT ... 
                 WHERE '${dataimporter.request.clean}' = 'true'
                        OR 
                       facet IN (facet1, facet2)">
    

    So for indexing documents only in facet1 and facet2 you would use

    dataimport?command=full-import&clean=false

    For doing a full import for all facets, use:

    dataimport?command=full-import&clean=true

    (I haven't tested this, so just make sure.)