public class QueryCanonicalizer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
QueryCanonicalizer.CanonicalizationResult |
Modifier and Type | Field and Description |
---|---|
static String |
queryCanonicalization
The name of the operation performed by this, for use in search chain ordering
|
Constructor and Description |
---|
QueryCanonicalizer() |
Modifier and Type | Method and Description |
---|---|
static String |
canonicalize(Query query)
Validates this query and carries out possible operations on this query
which simplifies it without changing its semantics.
|
static String |
canonicalize(QueryTree query)
Canonicalize this query
|
private static QueryCanonicalizer.CanonicalizationResult |
canonicalizeThis(Item item,
ListIterator<Item> parentIterator) |
private static boolean |
collapseFalse(CompositeItem composite,
ListIterator<Item> parentIterator)
Handle FALSE items in the immediate children of this
|
private static void |
collapseLevels(CompositeItem composite) |
private static void |
collapseLevels(CompositeItem composite,
ListIterator<Item> i)
Collapse the next item of this iterator into the given parent, if appropriate
|
private static boolean |
containsFalse(CompositeItem composite) |
private static void |
makeDuplicatesCheap(Item item,
Set<TermItem> rankTerms) |
private static void |
makeDuplicatesCheap(RankItem rankItem)
If a term is present as both a rank term (i.e not the first child) and in
the match condition (first child), then turn off any rank calculation for
the term during matching, as it will be made available anyway for matches
by the same term in the rank part.
|
private static void |
moveChildren(CompositeItem from,
ListIterator<Item> toIterator) |
private static QueryCanonicalizer.CanonicalizationResult |
recursivelyCanonicalize(Item item,
ListIterator<Item> parentIterator)
Canonicalize this query
|
private static void |
removeDuplicates(EquivItem composite) |
private static void |
removeFalseIn(ListIterator<Item> iterator) |
public static final String queryCanonicalization
public static String canonicalize(Query query)
public static String canonicalize(QueryTree query)
private static QueryCanonicalizer.CanonicalizationResult recursivelyCanonicalize(Item item, ListIterator<Item> parentIterator)
item
- the item to canonicalizeparentIterator
- iterator for the parent of this item, never nullprivate static QueryCanonicalizer.CanonicalizationResult canonicalizeThis(Item item, ListIterator<Item> parentIterator)
private static void collapseLevels(CompositeItem composite)
private static void collapseLevels(CompositeItem composite, ListIterator<Item> i)
private static void moveChildren(CompositeItem from, ListIterator<Item> toIterator)
private static boolean collapseFalse(CompositeItem composite, ListIterator<Item> parentIterator)
private static boolean containsFalse(CompositeItem composite)
private static void removeFalseIn(ListIterator<Item> iterator)
private static void removeDuplicates(EquivItem composite)
private static void makeDuplicatesCheap(RankItem rankItem)
rankItem
- an item which will be simplified in placeCopyright © 2018. All rights reserved.