lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: SortField.STRING
Date Wed, 24 Oct 2012 18:55:56 GMT
SortField.Type.STRING maybe?

Can't help with the other question.  It's generally best to send one
question per message.  Looking at the source code might help.


--
Ian.


On Wed, Oct 24, 2012 at 6:55 PM, Carlos de Luna Saenz
<cdelunasaenz@yahoo.com.mx> wrote:
> I am migrating code from Lucene 3 to Lucene 4... and i have the following code that i
don't know how to change:
>
> hits = searcher.search(queryGlobal, searcher.maxDoc(),
>                     new Sort(new SortField(ordenarPor, SortField.STRING)));
>
> I already change the searcher.maxDoc() to indxr.maxDoc() but SortField.STRING does not
exist anymore... what do i have to do?
> In the same code i have a class called SpanishAnalyzer:
> public class SpanishAnalyzer  extends Analyzer {
>      public static final String[] SPANISH_STOP_WORDS = { "." };
>
>      private Set<Object> stopTable = new HashSet<Object>();
>
>      private Set<Object> exclTable = new HashSet<Object>();
>
>      public SpanishAnalyzer() {
>         stopTable = StopFilter.makeStopSet(Version.LUCENE_40,SPANISH_STOP_WORDS);
>
>     }
>      public SpanishAnalyzer(Version version){
>          stopTable = StopFilter.makeStopSet(version,SPANISH_STOP_WORDS);
>      }
>
>      public SpanishAnalyzer(String[] stopWords) {
>         stopTable = StopFilter.makeStopSet(Version.LUCENE_40,stopWords);
>     }
>      public SpanishAnalyzer(File stopWords) throws IOException {
>         stopTable = new HashSet(WordlistLoader.getWordSet(new FileReader(stopWords),
Version.LUCENE_40));
>     }
>
> //    @Override
> //    public TokenStream tokenStream(String fieldName, Reader reader) {
> //        return new LowerCaseFilter(Version.LUCENE_40,new ASCIIFoldingFilter(
> //                new StopFilter(Version.LUCENE_40,
> //                                new StandardTokenizer(Version.LUCENE_40,
> //                                                      reader),
> //                                stopTable)));
> //    }
>     @Override
>     protected TokenStreamComponents createComponents(String string, Reader reader) {
>         throw new UnsupportedOperationException("Not supported yet.");
>     }
>
> }
>
> The problem is that i can't override TokenStream anymore and now i have to implement
the createComponents method and i am not sure what do i supposed to do there... thanks in
advance for both troubles.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message