add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / contrib / xml-query-parser / src / test / org / apache / lucene / xmlparser / CachedFilter.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <FilteredQuery>
3         <Query>
4                 <BooleanQuery fieldName="contents">
5                         <Clause occurs="should">
6                                 <TermQuery>merger</TermQuery>
7                         </Clause>
8                         <Clause occurs="mustnot">
9                                 <TermQuery >sumitomo</TermQuery>                
10                         </Clause>
11                 </BooleanQuery>
12         </Query>
13         
14         <Filter>
15                 <!--
16                         CachedFilter elements can contain any Query or Filter. 
17                         CachedFilters are cached in an LRU Cache keyed on the contained query/filter object. 
18                         Using this will speed up overall performance for repeated uses of the same expensive 
19                         query/filter. The sorts of queries likely to benefit from caching need not necessarily be 
20                         complex - e.g. simple TermQuerys with a large DF (document frequency) can be expensive
21                         on large indexes. A good example of this might be a term query on a field with only 2 possible 
22                         values - "true" or "false". In a large index, querying or filtering on this field requires 
23                         reading millions of document ids from disk which can more usefully be cached as a 
24                         QueryFilter bitset.
25                         
26                         For Queries/Filters to be cached and reused the object must implement hashcode and
27                         equals methods correctly so that duplicate queries/filters can be detected in the cache.
28                         
29                         The CoreParser.maxNumCachedFilters property can be used to control the size
30                         of the LRU Cache established during the construction of CoreParser instances.
31                         -->
32                 <CachedFilter>
33                         <!-- Example query to be cached for fast, repeated use -->
34                         <TermQuery fieldName="contents">bank</TermQuery> 
35                         <!-- Alternatively, a filter object can be cached ....
36                                 <RangeFilter fieldName="date" lowerTerm="19870409" upperTerm="19870412"/>
37                         -->                             
38                 </CachedFilter>
39         </Filter>
40         
41 </FilteredQuery>