Hey Chris,
Here's a basic summary of what I've discovered so far getting my metadata
into a Solr index...
SolrIndexer queries metadata for a single or multiple products from a File
Manager and put them into a Solr index. It does this by an http POST to
solr/update. Very cool.
Because it's xml on the wire, its really easy to tcpdump and view the
actual POST and see what the content is :). This is how I discovered that
the indexAll was not updating solr (see below).
Okay so for a simple test, I set up the following mapping, since these
fields already exist in the Solr schema.xml file:
map.ExperimentID=id
map.Observer=author
map.Description=description
Note: It seems a good idea to have an "id" field. If you look in the solr
scheme.xml file, I saw the following configuration by default:
<!-- Field to use to determine and enforce document uniqueness.
Unless this field is marked with required="false", it will be a
required field
-->
<uniqueKey>id</uniqueKey>
Okay, so I finally ran the SolrIndexer with the -all.
This piece of code (starting at line 209 of SolrIndexer.java) was never
executed. It's checking for metadata "UUID". I don't have this metadata
key.
if (metadata.getMetadata("UUID") != null) {
if (metadata.getMetadata("Deleted") == null
|| !"true".equals(metadata.getMetadata("Deleted"))) {
try {
server.add(this.getSolrDocument(metadata));
server.commit();
LOG.info("Indexed " + metadata.getMetadata("UUID"));
} catch (Exception e) {
LOG.severe("Could not index " + metadata.getMetadata(
"UUID")
+ " " + e.getMessage());
}
} else {
LOG.info("Skipping Deleted: " + metadata.getMetadata("UUID"
));
}
}
Question: Deleted looks optional, so no problem there, but what should I be
doing with UUID? I've changed this to be CAS.ProductId in the code, just to
check nothing else was causing a problem. I thought it would be worth
asking why UUID is specified...
I've tried the single product index, which works just fine.
Cheers,
Tom
On 30 March 2012 20:38, Mattmann, Chris A (388J) <
[email protected]> wrote:
> No worries...based on your email below, did you update the Solr schema? I
> think you need
> to tell it to allow for all fields, by uncommenting the dynamicField block
> in the schema.xml file
> to say "allow all fields" to come through, or modify the schema.xml in
> Solr's conf directory to
> specify which fields to send to Solr.
>
> Does that make sense? I can provide more detailed help and will follow up
> later, but
> see if that helps for now.
>
> Cheers,
> Chris