Type
- public class LuceneOptimizer<Type extends org.neo4j.graphdb.PropertyContainer> extends Object
(((service.dvbOriginalNetworkId = 1536) and (service.dvbTransportStreamId = 2069) and (service.dvbServiceId = 19322)) and (endDateTime >= (com.webobjects.foundation.NSTimestamp)'2012-06-07 04:00:00 Etc/GMT'))LuceneQueryConverter doesn't support relationships so it would convert it to:
+(+(+#_type:WEPGEvent +#_type:WEPGEvent +#_type:WEPGEvent) +endDateTime:[2012060706:00:00:000 TO ZZZZ]) +#_type:WEPGEventwhich would return more results than actually matching the original query. We could optimize lucene query by first searching for services matching
dvbOriginalNetworkId = 1536 and dvbTransportStreamId = 2069 and dvbServiceId = 19322and then replace ((service.dvbOriginalNetworkId = 1536) and (service.dvbTransportStreamId = 2069) and (service.dvbServiceId = 19322)) part with matching service IDs, so we could get in result something like: +(+(+(+#_type:WEPGEvent +#_type:WEPGEvent +#_type:WEPGEvent) +endDateTime:[2012060706:00:00:000 TO ZZZZ]) +#_type:WEPGEvent) +(serviceId:00000000000000002026) instead.
Due to the fact that optimization process makes another Lucene query which has a around-constant overhead, we perform optimization attempt only if the initial number of results exceeds threshold of 1000. TODO: refactor
Modifier and Type | Field and Description |
---|---|
static int |
OPTIMIZATION_TRESHOLD
Perform optimization attempt only if there are more then this many results.
|
Constructor and Description |
---|
LuceneOptimizer(org.neo4j.graphdb.index.Index<Type> index) |
Modifier and Type | Method and Description |
---|---|
static boolean |
canBeOptimized(org.neo4j.graphdb.index.IndexHits<? extends org.neo4j.graphdb.PropertyContainer> hits,
com.webobjects.eocontrol.EOQualifier qualifier) |
Results<Type> |
optimize(org.apache.lucene.search.Query q,
com.webobjects.eoaccess.EOEntity entity,
com.webobjects.eocontrol.EOQualifier qualifier) |
public static final int OPTIMIZATION_TRESHOLD
public LuceneOptimizer(org.neo4j.graphdb.index.Index<Type> index)
Copyright © 2002 – 2020 Project Wonder.