Mercurial Hosting > luan
comparison src/luan/modules/lucene/LuceneIndex.java @ 1749:d1e7564a9ce5
improve query parser
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 09 Jan 2023 22:06:06 -0700 |
parents | 2958cf04d844 |
children | 164c6ea53147 |
comparison
equal
deleted
inserted
replaced
1748:c7d79ba1c476 | 1749:d1e7564a9ce5 |
---|---|
22 import java.util.zip.ZipOutputStream; | 22 import java.util.zip.ZipOutputStream; |
23 import java.util.zip.ZipEntry; | 23 import java.util.zip.ZipEntry; |
24 import org.apache.lucene.analysis.Analyzer; | 24 import org.apache.lucene.analysis.Analyzer; |
25 import org.apache.lucene.analysis.TokenStream; | 25 import org.apache.lucene.analysis.TokenStream; |
26 import org.apache.lucene.analysis.core.KeywordAnalyzer; | 26 import org.apache.lucene.analysis.core.KeywordAnalyzer; |
27 import org.apache.lucene.analysis.core.SimpleAnalyzer; | |
27 import org.apache.lucene.analysis.en.EnglishAnalyzer; | 28 import org.apache.lucene.analysis.en.EnglishAnalyzer; |
28 import org.apache.lucene.document.Document; | 29 import org.apache.lucene.document.Document; |
29 import org.apache.lucene.document.Field; | 30 import org.apache.lucene.document.Field; |
30 import org.apache.lucene.document.StoredField; | 31 import org.apache.lucene.document.StoredField; |
31 import org.apache.lucene.document.StringField; | 32 import org.apache.lucene.document.StringField; |
121 | 122 |
122 private static final Version luceneVersion = Version.LUCENE_4_9; | 123 private static final Version luceneVersion = Version.LUCENE_4_9; |
123 public static final StringFieldParser STRING_FIELD_PARSER = new StringFieldParser(new KeywordAnalyzer()); | 124 public static final StringFieldParser STRING_FIELD_PARSER = new StringFieldParser(new KeywordAnalyzer()); |
124 public static final StringFieldParser LOWERCASE_FIELD_PARSER = new StringFieldParser(new LowercaseAnalyzer(luceneVersion)); | 125 public static final StringFieldParser LOWERCASE_FIELD_PARSER = new StringFieldParser(new LowercaseAnalyzer(luceneVersion)); |
125 public static final StringFieldParser ENGLISH_FIELD_PARSER = new StringFieldParser(new EnglishAnalyzer(luceneVersion)); | 126 public static final StringFieldParser ENGLISH_FIELD_PARSER = new StringFieldParser(new EnglishAnalyzer(luceneVersion)); |
127 public static final StringFieldParser SIMPLE_FIELD_PARSER = new StringFieldParser(new SimpleAnalyzer(luceneVersion)); | |
126 private static final SortField ID_SORT = new SortField("id",SortField.Type.LONG); | 128 private static final SortField ID_SORT = new SortField("id",SortField.Type.LONG); |
127 private static final SortField ID_DESC_SORT = new SortField("id",SortField.Type.LONG,true); | 129 private static final SortField ID_DESC_SORT = new SortField("id",SortField.Type.LONG,true); |
128 | 130 |
129 private final Object version; | 131 private final Object version; |
130 | 132 |
725 boolean ok = loggingWriter.check(ID_SORT); | 727 boolean ok = loggingWriter.check(ID_SORT); |
726 } | 728 } |
727 logger.info("end check"); | 729 logger.info("end check"); |
728 } | 730 } |
729 | 731 |
732 public String explain_query(String queryStr) throws ParseException { | |
733 return GoodQueryParser.parseQuery(mfp,queryStr).toString(); | |
734 } | |
735 | |
730 } | 736 } |