On 10/3/2013 8:03 PM, Brian Robinson wrote:
> Hi Shawn,
> Thanks for responding. Just saw this email. I did go to the logging tab
> in the admin page, but it never finished loading. I'm using collection1,
> and I'm using the traditional config. Here is my complete code, with
> $options omitted for security:

It sounds like the logging for Solr is not set up properly, or that you
are using a binding that the logging tab doesn't know how to work with.
 The fact that you're on port 8080 probably means that you're running
under a servlet container other than the Jetty which ships in the Solr
example, so logging is not very straightforward.  It's strongly
recommended that you run Solr under the included Jetty, because all
these issues have been worked out.

There is a lot of info on the following wiki page on how to get logging
working correctly with the changes in Solr 4.3.0 and later:

http://wiki.apache.org/solr/SolrLogging

If you already understand how to deal with logging using your servlet
container, you might want to follow the instructions there for switching
to java.util.logging, which in many cases will let the container control
it all.

> $options = array
> (
>     'hostname' => 'localhost',
>     'login'    => 'XXXXX',
>     'password' => 'XXXXX',
>     'port'     => '8080',
> );
> 
> $client = new SolrClient($options);
> 
>    $lastUpdate = '2013-09-31';
>    $prod_result = $db_connect->query("
>        SELECT DISTINCT p.id, p.prodName, p.brand, bi.brandName,
> p.description, p.lastUpdate
>        FROM product_CJ p
>        INNER JOIN brands_inactive bi ON bi.feedID = p.brand
>        WHERE p.showProd='Y' AND p.lastUpdate > ? LIMIT 0, 1",
>        array($lastUpdate)
>    );
> 
>    $docArray = array();
>    while ($prod_row = $prod_result->fetchRow(DB_FETCHMODE_ASSOC)) {
>        $docArray[$prod_row['id']] = $prod_row;
>    }
> 
>    $solrDocs = array();
>    foreach ($docArray AS $prod_row) {
>          $tmpProdID = $prod_row['id'];
>          $doc = new SolrInputDocument();
>          $doc->addField('id', $tmpProdID);
>          $doc->addField('prodName', $prod_row['prodName']);
>          $doc->addField('brand', $prod_row['brand']);
>          $doc->addField('brandName', $prod_row['brandName']);
>          $doc->addField('description', $prod_row['description']);
>          $tmpUpdate = $prod_row['lastUpdate']."T00:00:00Z";
>          $doc->addField('lastUpdate', $tmpUpdate);
>          $solrDocs[] = $doc;
>    }
> 
>    foreach (array_chunk($solrDocs, 500) AS $solrChunk) {
>         $client->addDocuments($solrChunk);
>    }

I'm a little fuzzy on php code, and I've never used this library.  Yes,
I provided a patch for a bug, but that was pretty simple, and it was C
code, not php.

I know perl a whole lot better, but the two languages are pretty similar
to each other.  If you've stepped through the contents of $solrDocs
before trying to add it, and verified that it has the correct info, then
the basic structure seems solid.

One critical question is whether the request is making it to Solr, and
what Solr is responding with.  You might need to resort to things like
getting a sniffer trace with tcpdump or wireshark, which might involve
switching to the actual IP address rather than localhost.

Thanks,
Shawn

Reply via email to