public class RewriterFeatures extends Object
Constructor and Description |
---|
RewriterFeatures() |
Modifier and Type | Method and Description |
---|---|
static Query |
addExpansions(Query query,
Set<PhraseMatcher.Phrase> matches,
String expandIndex,
int maxNumRewrites,
boolean removeOriginal,
boolean addUnitToRewrites)
Add Expansions to the matching phrases
|
static Query |
addRewritesAsEquiv(Query query,
String matchingStr,
String rewrites,
boolean addUnitToRewrites,
int maxNumRewrites)
Add query expansion to the query tree
|
static Query |
addUnitToOriginalQuery(Query query,
String boostingQuery,
boolean keepOriginalQuery)
Add proximity boosting to original query by modifying
the query tree directly
|
static String |
convertMatchToString(PhraseMatcher.Phrase phrase)
Convert Match to String
|
static Set<PhraseMatcher.Phrase> |
getNonOverlappingFullPhraseMatches(PhraseMatcher phraseMatcher,
Query query)
Retrieve the longest, from left to right non overlapping full
phrase substrings in query based on FSA dictionary
|
static List<PhraseMatcher.Phrase> |
getNonOverlappingMatchesInAndItem(List<PhraseMatcher.Phrase> allMatches,
Query query)
Retrieve the longest, from left to right non overlapping substrings in
AndItem based on FSA dictionary
|
static Set<PhraseMatcher.Phrase> |
getNonOverlappingPartialPhraseMatches(PhraseMatcher phraseMatcher,
Query query)
Retrieve the longest, from left to right non overlapping partial
phrase substrings in query based on FSA dictionary
|
public static Query addUnitToOriginalQuery(Query query, String boostingQuery, boolean keepOriginalQuery) throws RuntimeException
Add proximity boosting to original query by modifying the query tree directly
e.g. original Query Tree: (AND aa bb)query
- Query object from searcherboostingQuery
- query to be boostedkeepOriginalQuery
- whether to keep original unboosted query as equivRuntimeException
public static Query addRewritesAsEquiv(Query query, String matchingStr, String rewrites, boolean addUnitToRewrites, int maxNumRewrites) throws RuntimeException
Add query expansion to the query tree
e.g. origQuery: aa bbquery
- Query object from searchermatchingStr
- string used to retrieve the rewriterewrites
- The rewrite string retrieved from
dictionaryaddUnitToRewrites
- Whether to add unit to rewritesmaxNumRewrites
- Max number of rewrites to be added,
0 if no limitRuntimeException
public static Set<PhraseMatcher.Phrase> getNonOverlappingFullPhraseMatches(PhraseMatcher phraseMatcher, Query query) throws RuntimeException
Retrieve the longest, from left to right non overlapping full phrase substrings in query based on FSA dictionary
e.g. query: ((modern AND new AND york AND city AND travel) OR travel) AND ((sunny AND travel AND agency) OR nyc)phraseMatcher
- PhraseMatcher object loaded with FSA dictquery
- Query object from the searcherRuntimeException
public static Set<PhraseMatcher.Phrase> getNonOverlappingPartialPhraseMatches(PhraseMatcher phraseMatcher, Query query) throws RuntimeException
Retrieve the longest, from left to right non overlapping partial phrase substrings in query based on FSA dictionary
e.g. query: ((modern AND new AND york AND city AND travel) OR travel) AND ((sunny AND travel AND agency) OR nyc)phraseMatcher
- PhraseMatcher object loaded with FSA dictquery
- Query object from the searcherRuntimeException
public static List<PhraseMatcher.Phrase> getNonOverlappingMatchesInAndItem(List<PhraseMatcher.Phrase> allMatches, Query query) throws RuntimeException
Retrieve the longest, from left to right non overlapping substrings in AndItem based on FSA dictionary
e.g. subtree: (modern AND new AND york AND city AND travel)allMatches
- All matches within the subtreequery
- Query object from the searcherRuntimeException
public static Query addExpansions(Query query, Set<PhraseMatcher.Phrase> matches, String expandIndex, int maxNumRewrites, boolean removeOriginal, boolean addUnitToRewrites) throws RuntimeException
Add Expansions to the matching phrases
e.g. Query: nyc travel agencyquery
- Query object from searchermatches
- Set of longest non-overlapping matchesexpandIndex
- Name of expansion index or null if
default indexmaxNumRewrites
- Max number of rewrites to be added,
0 if no limitremoveOriginal
- Whether to remove the original matching phraseaddUnitToRewrites
- Whether to add rewrite as phraseRuntimeException
public static String convertMatchToString(PhraseMatcher.Phrase phrase)
phrase
- Match from PhraseMatcherCopyright © 2018. All rights reserved.