mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
Reduce resource waste (#128)
This commit is contained in:
parent
674af5449d
commit
f0f82f7db0
@ -26,13 +26,13 @@ once per 6-8 weeks, coinciding with the crawling
|
|||||||
cycle. Where model-breaking changes and changes to
|
cycle. Where model-breaking changes and changes to
|
||||||
the crawler can be introduced.
|
the crawler can be introduced.
|
||||||
|
|
||||||
## Quick Set Up
|
## Running and set-up
|
||||||
|
|
||||||
There is a [Set Up Guide](https://git.marginalia.nu/marginalia/marginalia.nu/wiki/Setup/Search)
|
There is a complementary project, wmsa.local, which
|
||||||
in the wiki. It has a small tendency to oxidize rather
|
contains scripts and instructions for running this
|
||||||
rapidly since the project currently does not have a
|
code base.
|
||||||
lot of contributors to test it. If you find a problem
|
|
||||||
with the guide, email <kontakt@marginalia.nu>.
|
[https://git.marginalia.nu/marginalia/wmsa.local](https://git.marginalia.nu/marginalia/wmsa.local)
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ Documentation is a work in progress. See the [wiki](https://git.marginalia.nu/ma
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
The project is still being set up, but if you are interested in contributing, please contact me.
|
[CONTRIBUTING.md](CONTRIBUTING.md)
|
||||||
|
|
||||||
## Supporting
|
## Supporting
|
||||||
|
|
||||||
|
@ -23,15 +23,13 @@ import java.util.*;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class QueryFactory {
|
public class QueryFactory {
|
||||||
|
|
||||||
private final LanguageModels lm;
|
|
||||||
private final TermFrequencyDict dict;
|
|
||||||
private final EnglishDictionary englishDictionary;
|
private final EnglishDictionary englishDictionary;
|
||||||
private final NGramBloomFilter nGramBloomFilter;
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
private final SearchResultValuator searchResultValuator;
|
private final SearchResultValuator searchResultValuator;
|
||||||
private NearQueryProcessor nearQueryProcessor;
|
private final NearQueryProcessor nearQueryProcessor;
|
||||||
|
|
||||||
private static final int RETAIN_QUERY_VARIANT_COUNT = 5;
|
private static final int RETAIN_QUERY_VARIANT_COUNT = 5;
|
||||||
|
private final ThreadLocal<QueryVariants> queryVariants;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public QueryFactory(LanguageModels lm,
|
public QueryFactory(LanguageModels lm,
|
||||||
@ -40,17 +38,16 @@ public class QueryFactory {
|
|||||||
NGramBloomFilter nGramBloomFilter,
|
NGramBloomFilter nGramBloomFilter,
|
||||||
SearchResultValuator searchResultValuator,
|
SearchResultValuator searchResultValuator,
|
||||||
NearQueryProcessor nearQueryProcessor) {
|
NearQueryProcessor nearQueryProcessor) {
|
||||||
this.lm = lm;
|
|
||||||
this.dict = dict;
|
|
||||||
|
|
||||||
this.englishDictionary = englishDictionary;
|
this.englishDictionary = englishDictionary;
|
||||||
this.nGramBloomFilter = nGramBloomFilter;
|
|
||||||
this.searchResultValuator = searchResultValuator;
|
this.searchResultValuator = searchResultValuator;
|
||||||
this.nearQueryProcessor = nearQueryProcessor;
|
this.nearQueryProcessor = nearQueryProcessor;
|
||||||
|
|
||||||
|
this.queryVariants = ThreadLocal.withInitial(() -> new QueryVariants(lm, dict, nGramBloomFilter, englishDictionary));
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryParser getParser() {
|
public QueryParser getParser() {
|
||||||
return new QueryParser(englishDictionary, new QueryVariants(lm ,dict, nGramBloomFilter, englishDictionary));
|
return new QueryParser(englishDictionary, queryVariants.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public EdgeSearchQuery createQuery(EdgeUserSearchParameters params) {
|
public EdgeSearchQuery createQuery(EdgeUserSearchParameters params) {
|
||||||
@ -219,7 +216,6 @@ public class QueryFactory {
|
|||||||
EdgeSearchSpecification specs = specsBuilder.build();
|
EdgeSearchSpecification specs = specsBuilder.build();
|
||||||
|
|
||||||
return new EdgeSearchQuery(specs, searchTermsHuman, domain);
|
return new EdgeSearchQuery(specs, searchTermsHuman, domain);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String normalizeDomainName(String str) {
|
private String normalizeDomainName(String str) {
|
||||||
|
Loading…
Reference in New Issue
Block a user