fix index
This commit is contained in:
parent
6109d25816
commit
8b20596398
@ -3,6 +3,7 @@
|
||||
*/
|
||||
package de.bstly.board;
|
||||
|
||||
import org.apache.lucene.analysis.charfilter.HTMLStripCharFilterFactory;
|
||||
import org.apache.lucene.analysis.core.LowerCaseFilterFactory;
|
||||
import org.apache.lucene.analysis.miscellaneous.ASCIIFoldingFilterFactory;
|
||||
import org.apache.lucene.analysis.snowball.SnowballPorterFilterFactory;
|
||||
@ -26,11 +27,13 @@ public class LuceneConfig implements LuceneAnalysisConfigurer {
|
||||
@Override
|
||||
public void configure(LuceneAnalysisConfigurationContext context) {
|
||||
context.analyzer("english").custom().tokenizer(StandardTokenizerFactory.class)
|
||||
.charFilter(HTMLStripCharFilterFactory.class)
|
||||
.tokenFilter(LowerCaseFilterFactory.class)
|
||||
.tokenFilter(SnowballPorterFilterFactory.class).param("language", "English")
|
||||
.tokenFilter(ASCIIFoldingFilterFactory.class);
|
||||
|
||||
context.analyzer("german").custom().tokenizer(StandardTokenizerFactory.class)
|
||||
.charFilter(HTMLStripCharFilterFactory.class)
|
||||
.tokenFilter(LowerCaseFilterFactory.class)
|
||||
.tokenFilter(SnowballPorterFilterFactory.class).param("language", "German")
|
||||
.tokenFilter(ASCIIFoldingFilterFactory.class);
|
||||
|
@ -93,16 +93,20 @@ public class SearchManager implements SmartInitializingSingleton {
|
||||
if (classes.contains(Entry.class)) {
|
||||
return searchSession.search(classes)
|
||||
.where(f -> f.bool()
|
||||
.should(f.match().fields("title", "title_de").matching(search)
|
||||
.should(f.match().field("title").matching(search)
|
||||
.boost(settingsManager.getGravity()))
|
||||
.should(f.match().fields("text", "text_de").matching(search)))
|
||||
.should(f.match().field("title_de").matching(search)
|
||||
.boost(settingsManager.getGravity()))
|
||||
.should(f.match().field("text").matching(search))
|
||||
.should(f.match().field("text_de").matching(search)))
|
||||
.sort(f -> sortByDate
|
||||
? (asc ? f.field("created").asc() : f.field("created").desc())
|
||||
: (asc ? f.score().asc() : f.score().desc()))
|
||||
.fetch(page * size, size);
|
||||
} else {
|
||||
return searchSession.search(classes).where(
|
||||
f -> f.bool().should(f.match().fields("text", "text_de").matching(search)))
|
||||
return searchSession.search(classes)
|
||||
.where(f -> f.bool().should(f.match().field("text").matching(search))
|
||||
.should(f.match().field("text_de").matching(search)))
|
||||
.sort(f -> sortByDate
|
||||
? (asc ? f.field("created").asc() : f.field("created").desc())
|
||||
: (asc ? f.score().asc() : f.score().desc()))
|
||||
|
Loading…
Reference in New Issue
Block a user