You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by BlackIce <bl...@gmail.com> on 2018/05/23 13:25:30 UTC

Trying to update Solrj in our app...

Hi,

I've got an app here that posts data to Solr using Solrj...
I'm trying to update all our apps dependencies, and now I've reached Solrj
 Last kown working version is 5.5.0, anything after that dies at compile
time with:

 cannot find symbol
    [javac] import org.apache.solr.common.util.DateUtil;
    [javac]                                                         ^
    [javac]   symbol:   class DateUtil
    [javac]   location: package org.apache.solr.common.util

AND:


 error: cannot find symbol
    [javac]           val2 =
DateUtil.getThreadLocalDateFormat().format(val);
    [javac]                       ^
    [javac]   symbol:   variable DateUtil
    [javac]   location: class SolrIndexWriter

Doing some research, it tells me that at some point DateUtil was deprecated
from the solr ... and it says something like to use Instant.format()
instead, if someone needs to format the date for some reason..
so I comment out..
import org.apache.solr.common.util.DateUtil;

AND this is being imported...

import java.util.Date;


and I'm only left with the second error.....

So, the question is what does this code have to look like for a current
version of Solrj?:

// normalise the string representation for a Date
Object val2 = val;

if (val instanceof Date) {
  val2 =  DateUtil.getThreadLocalDateFormat().format(val);
}


If someone would be so kind to give me a hand here it would be greatly
apreciated..


thnx

Re: Trying to update Solrj in our app...

Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/23/2018 11:46 AM, BlackIce wrote:
> Is there a list of things that have been deprecated in solr since 5.0.0? Or
> do I have to read EVERY release readme till I get to 7.3.1?

The javadoc for each release has pages that list all deprecations in
that release on a per-module basis, so there are different pages for
solr-solrj, solr-core, and other modules within the source code.

Typically for user code, you're only going to care about SolrJ.  Here's
the page for SolrJ 7.3.1:

https://lucene.apache.org/solr/7_3_1/solr-solrj/deprecated-list.html

You can change the version number in the URL to get different versions. 
Here's the one for 6.6.3:

https://lucene.apache.org/solr/6_6_3/solr-solrj/deprecated-list.html

If you want to get an idea of what's completely eliminated from a
certain major release, look at the javadoc for the class you're
interested, find the page specific to the latest release in the previous
major version, and click on "deprecated" at the top of the page.  So to
find out what's missing from 7.x, you would load the page for 6.6.3,
which is currently the latest 6.x release.

Thanks,
Shawn


Re: Trying to update Solrj in our app...

Posted by BlackIce <bl...@gmail.com>.
Hi again,

Is there a list of things that have been deprecated in solr since 5.0.0? Or
do I have to read EVERY release readme till I get to 7.3.1?

On Wed, May 23, 2018 at 4:31 PM, BlackIce <bl...@gmail.com> wrote:

> Thnx, but that doesn't compile either... lemme read up this...
>
> On Wed, May 23, 2018 at 3:52 PM, Shawn Heisey <ap...@elyograg.org> wrote:
>
>> On 5/23/2018 7:25 AM, BlackIce wrote:
>>
>>> I've got an app here that posts data to Solr using Solrj...
>>> I'm trying to update all our apps dependencies, and now I've reached
>>> Solrj
>>>   Last kown working version is 5.5.0, anything after that dies at compile
>>> time with:
>>>
>> <snip>
>>
>>> if (val instanceof Date) {
>>>    val2 =  DateUtil.getThreadLocalDateFormat().format(val);
>>> }
>>>
>>
>> Use this instead:
>>
>> val2 = DateTimeFormatter.ISO_INSTANT.format(val.toInstant());
>>
>> ISO_INSTANT is probably what you want, but there are other choices if
>> that's not the correct format.
>>
>> This will require a new import -- java.time.format.DateTimeFormatter.
>> And you will need JDK 8, which you should already have because SolrJ 6.0
>> and later requires it.
>>
>> Thanks,
>> Shawn
>>
>>
>

Re: Trying to update Solrj in our app...

Posted by BlackIce <bl...@gmail.com>.
Thnx, but that doesn't compile either... lemme read up this...

On Wed, May 23, 2018 at 3:52 PM, Shawn Heisey <ap...@elyograg.org> wrote:

> On 5/23/2018 7:25 AM, BlackIce wrote:
>
>> I've got an app here that posts data to Solr using Solrj...
>> I'm trying to update all our apps dependencies, and now I've reached Solrj
>>   Last kown working version is 5.5.0, anything after that dies at compile
>> time with:
>>
> <snip>
>
>> if (val instanceof Date) {
>>    val2 =  DateUtil.getThreadLocalDateFormat().format(val);
>> }
>>
>
> Use this instead:
>
> val2 = DateTimeFormatter.ISO_INSTANT.format(val.toInstant());
>
> ISO_INSTANT is probably what you want, but there are other choices if
> that's not the correct format.
>
> This will require a new import -- java.time.format.DateTimeFormatter. And
> you will need JDK 8, which you should already have because SolrJ 6.0 and
> later requires it.
>
> Thanks,
> Shawn
>
>

Re: Trying to update Solrj in our app...

Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/23/2018 7:25 AM, BlackIce wrote:
> I've got an app here that posts data to Solr using Solrj...
> I'm trying to update all our apps dependencies, and now I've reached Solrj
>   Last kown working version is 5.5.0, anything after that dies at compile
> time with:
<snip>
> if (val instanceof Date) {
>    val2 =  DateUtil.getThreadLocalDateFormat().format(val);
> }

Use this instead:

val2 = DateTimeFormatter.ISO_INSTANT.format(val.toInstant());

ISO_INSTANT is probably what you want, but there are other choices if 
that's not the correct format.

This will require a new import -- java.time.format.DateTimeFormatter. 
And you will need JDK 8, which you should already have because SolrJ 6.0 
and later requires it.

Thanks,
Shawn