public class SolrIndexer extends Object
Modifier and Type | Class and Description |
---|---|
class |
SolrIndexer.IndexerConfig
This class manages the Indexer configuration.
|
Constructor and Description |
---|
SolrIndexer(String solrUrl,
String fmUrl)
Constructor reads in the configuration and initiates the connection to the
Solr instance.
|
Modifier and Type | Method and Description |
---|---|
static org.apache.commons.cli.Options |
buildCommandLine()
This method builds the command-line options.
|
void |
commit()
This method commits all of the modifications to the Solr index.
|
void |
delete()
This method deletes all entries from the Solr index.
|
void |
deleteProduct(String productId)
This method deletes a single product identified by a productID from the Solr index
|
void |
deleteProductByName(String productName)
This method deletes a product(s) from the Solr index identified by a given name
|
void |
indexAll(boolean delete)
This method indexes all products retrieved from the File Manager to the
Solr index.
|
void |
indexMetFile(File file,
boolean delete)
This method adds a single product extracted from a metadata file to the
Solr index.
|
void |
indexProduct(String productId)
This method adds a single product retrieved from the File Manager by its
product identifier to the Solr index.
|
void |
indexProductByName(String productName,
boolean delete)
This method adds a single product retrieved from the File Manager by its
product name to the Solr index.
|
void |
indexProductTypes(boolean delete)
This method indexes all product types retrieved from the File Manager to
the Solr index.
|
static void |
main(String[] args)
The main method.
|
void |
optimize()
This method optimizes the Solr index.
|
public SolrIndexer(String solrUrl, String fmUrl) throws InstantiationException
solrUrl
- URL for the Solr instance.fmUrl
- URL for the File Manager instance.InstantiationException
public void delete() throws org.apache.solr.client.solrj.SolrServerException, IOException
org.apache.solr.client.solrj.SolrServerException
IOException
public void commit() throws org.apache.solr.client.solrj.SolrServerException, IOException
org.apache.solr.client.solrj.SolrServerException
IOException
public void optimize() throws org.apache.solr.client.solrj.SolrServerException, IOException
org.apache.solr.client.solrj.SolrServerException
IOException
public void indexMetFile(File file, boolean delete) throws org.apache.solr.client.solrj.SolrServerException
file
- The file containing product metadata.delete
- Flag indicating whether the entry should be deleted from the
index.org.apache.solr.client.solrj.SolrServerException
- When an error occurs communicating with the Solr server instance.public void indexProductTypes(boolean delete)
delete
- Flag indicating whether each product type retrieved from the File
Manager should be deleted from the index.org.apache.solr.client.solrj.SolrServerException
- When an error occurs communicating with the Solr server instance.public void indexAll(boolean delete)
delete
- Flag indicating whether each product retrieved from the File
Manager should be deleted from the index.org.apache.solr.client.solrj.SolrServerException
- When an error occurs communicating with the Solr server instance.public void indexProduct(String productId) throws org.apache.solr.client.solrj.SolrServerException
productId
- The identifier of the product (CAS.ProductId).org.apache.solr.client.solrj.SolrServerException
- When an error occurs communicating with the Solr server instance.public void indexProductByName(String productName, boolean delete) throws org.apache.solr.client.solrj.SolrServerException
productName
- The identifier of the product (CAS.ProductId).delete
- Flag indicating whether the entry should be deleted from the
index.org.apache.solr.client.solrj.SolrServerException
- When an error occurs communicating with the Solr server instance.public void deleteProduct(String productId) throws IOException, org.apache.solr.client.solrj.SolrServerException
productId
- IOException
org.apache.solr.client.solrj.SolrServerException
public void deleteProductByName(String productName)
productName
- IOException
org.apache.solr.client.solrj.SolrServerException
public static org.apache.commons.cli.Options buildCommandLine()
public static void main(String[] args)
args
- Command-line arguments.Copyright © 1999–2017 Apache OODT. All rights reserved.