RE: getLocale of SortField
Hi, it was not completely removed (it was intended to be removed). See the migration guide @ http://lucene.apache.org/core/4_3_1/MIGRATE.html, section about LUCENE-2514. The constructor and the logic was removed from SortField. The fast replacement (means sorting works as fast without collating) is to index the fields used for sorting with CollationKeyAnalyzer (https://lucene.apache.org/core/4_3_1/analyzers-common/org/apache/lucene/collation/CollationKeyAnalyzer.html). The Collator you get from e.g. the locale. The slow replacement (which is factored out from the old SortField stuff using the locale) is: http://lucene.apache.org/core/4_3_1/sandbox/org/apache/lucene/sandbox/queries/SlowCollatedStringComparator.html - use this class a custom sort comparator in your SortField. But be warned: It is horrible slow. The better was is, as mentioned before, to index the collated sort keys in the index and do a binary sort on the (non human-readable) keys. Uwe - Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de -Original Message- From: Trejkaz [mailto:trej...@trypticon.org] Sent: Wednesday, July 10, 2013 6:22 AM To: java-user@lucene.apache.org Subject: Re: getLocale of SortField On Wed, Jul 10, 2013 at 12:53 AM, Uwe Schindler u...@thetaphi.de wrote: Hi, there is no more locale-based sorting in Lucene 4.x. It was deprecated in 3.x, so you should get a warning about deprecation already! I wasn't sure about this because we are on 3.6 and I didn't see a deprecation warning in our code either. So I did some research. In 3.6.2, it was *NOT* deprecated: http://lucene.apache.org/core/3_6_2/api/all/org/apache/lucene/search/Sor tField.html#SortField(java.lang.String, java.util.Locale) In 4.0.0, it is completely removed: http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/search/Sort Field.html Was there a release between 3.6.2 and 4.0.0 or did the Lucene project just remove a constructor people were using with no warning nor direct replacement? TX - To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org - To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org
Re: getLocale of SortField
On Wed, Jul 10, 2013 at 4:20 PM, Uwe Schindler u...@thetaphi.de wrote: Hi, The fast replacement (means sorting works as fast without collating) is to index the fields used for sorting with CollationKeyAnalyzer ([snip]). The Collator you get from e.g. the locale. [snip] The better was is, as mentioned before, to index the collated sort keys in the index and do a binary sort on the (non human-readable) keys. So... one field dedicated for sorting per locale. Or at least per unique comparator (maybe multiple languages share sorting rules somewhere.) That seems like it could eat some space... I wonder if it couldn't just apply the collator when caching the values for sorting. Then it would all be in memory so it should work at the same speed as what's being done now. TX - To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org
RE: getLocale of SortField
Hi, there is no more locale-based sorting in Lucene 4.x. It was deprecated in 3.x, so you should get a warning about deprecation already! Uwe - Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de -Original Message- From: Yonghui Zhao [mailto:zhaoyong...@gmail.com] Sent: Tuesday, July 09, 2013 1:45 PM To: java-user@lucene.apache.org Subject: getLocale of SortField I am updating one project from lucene 3.x to lucene 4.x I found getLocale of SortField is moved. How can I fix it? - To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org
RE: getLocale of SortField
got it. Thanks 在 2013-7-9 下午10:54,Uwe Schindler u...@thetaphi.de写道: Hi, there is no more locale-based sorting in Lucene 4.x. It was deprecated in 3.x, so you should get a warning about deprecation already! Uwe - Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de -Original Message- From: Yonghui Zhao [mailto:zhaoyong...@gmail.com] Sent: Tuesday, July 09, 2013 1:45 PM To: java-user@lucene.apache.org Subject: getLocale of SortField I am updating one project from lucene 3.x to lucene 4.x I found getLocale of SortField is moved. How can I fix it? - To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org
RE: getLocale of SortField
You should look at at using the cool new Analysis features of Lucene 4. But that needs rewriting your code. - Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de -Original Message- From: Yonghui Zhao [mailto:zhaoyong...@gmail.com] Sent: Tuesday, July 09, 2013 4:57 PM To: java-user@lucene.apache.org Subject: RE: getLocale of SortField got it. Thanks 在 2013-7-9 下午10:54,Uwe Schindler u...@thetaphi.de写道: Hi, there is no more locale-based sorting in Lucene 4.x. It was deprecated in 3.x, so you should get a warning about deprecation already! Uwe - Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de -Original Message- From: Yonghui Zhao [mailto:zhaoyong...@gmail.com] Sent: Tuesday, July 09, 2013 1:45 PM To: java-user@lucene.apache.org Subject: getLocale of SortField I am updating one project from lucene 3.x to lucene 4.x I found getLocale of SortField is moved. How can I fix it? - To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org - To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org
Re: getLocale of SortField
On Wed, Jul 10, 2013 at 12:53 AM, Uwe Schindler u...@thetaphi.de wrote: Hi, there is no more locale-based sorting in Lucene 4.x. It was deprecated in 3.x, so you should get a warning about deprecation already! I wasn't sure about this because we are on 3.6 and I didn't see a deprecation warning in our code either. So I did some research. In 3.6.2, it was *NOT* deprecated: http://lucene.apache.org/core/3_6_2/api/all/org/apache/lucene/search/SortField.html#SortField(java.lang.String, java.util.Locale) In 4.0.0, it is completely removed: http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/search/SortField.html Was there a release between 3.6.2 and 4.0.0 or did the Lucene project just remove a constructor people were using with no warning nor direct replacement? TX - To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org