当前位置: 首页>>代码示例>>Java>>正文


Java CachingWrapperFilter类代码示例

本文整理汇总了Java中org.apache.lucene.search.CachingWrapperFilter的典型用法代码示例。如果您正苦于以下问题:Java CachingWrapperFilter类的具体用法?Java CachingWrapperFilter怎么用?Java CachingWrapperFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CachingWrapperFilter类属于org.apache.lucene.search包,在下文中一共展示了CachingWrapperFilter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testWithCachingFilter

import org.apache.lucene.search.CachingWrapperFilter; //导入依赖的package包/类
public void testWithCachingFilter() throws Exception {
  Directory dir = newDirectory();
  RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
  IndexReader reader = writer.getReader();
  writer.close();

  IndexSearcher searcher = newSearcher(reader);

  Query query = new TermQuery(new Term("none", "none"));

  QueryWrapperFilter queryFilter = new QueryWrapperFilter(query);
  CachingWrapperFilter cachingFilter = new CachingWrapperFilter(queryFilter);

  searcher.search(query, cachingFilter, 1);

  CachingWrapperFilter cachingFilter2 = new CachingWrapperFilter(queryFilter);
  Filter[] chain = new Filter[2];
  chain[0] = cachingFilter;
  chain[1] = cachingFilter2;
  ChainedFilter cf = new ChainedFilter(chain);

  // throws java.lang.ClassCastException: org.apache.lucene.util.OpenBitSet cannot be cast to java.util.BitSet
  searcher.search(new MatchAllDocsQuery(), cf, 1);
  reader.close();
  dir.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:27,代码来源:ChainedFilterTest.java

示例2: getRecordForInv

import org.apache.lucene.search.CachingWrapperFilter; //导入依赖的package包/类
public static Record getRecordForInv(String invBroj){
	List<String> invList = new ArrayList<String>();
	invList.add(invBroj);
	CachingWrapperFilter filter = new CachingWrapperFilter(new BisisFilter(invList));
   int[] recordIds = BisisApp.getRecordManager().select3(new MatchAllDocsQuery(),filter, null);    
   if(recordIds.length==0) return null;
   return BisisApp.getRecordManager().getRecord(recordIds[0]);		
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:9,代码来源:GroupInvRecordUtils.java

示例3: getRecordsForInvs

import org.apache.lucene.search.CachingWrapperFilter; //导入依赖的package包/类
public static List<Record> getRecordsForInvs(List<String> invList){
	CachingWrapperFilter filter = new CachingWrapperFilter(new BisisFilter(invList));
   int[] recordIds = BisisApp.getRecordManager().select3(new MatchAllDocsQuery(),filter, null);
   List<Record> recList = new ArrayList<Record>(); 
   for(Record rec: BisisApp.getRecordManager().getRecords(recordIds))
   	recList.add(rec);    
   return recList;		
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:9,代码来源:GroupInvRecordUtils.java

示例4: FilterManager

import org.apache.lucene.search.CachingWrapperFilter; //导入依赖的package包/类
public FilterManager(List filterInvs){
  filter = new CachingWrapperFilter(new BisisFilter(filterInvs));
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:4,代码来源:FilterManager.java

示例5: run

import org.apache.lucene.search.CachingWrapperFilter; //导入依赖的package包/类
public JasperPrint run(String odInvBr, String doInvBr, String reportName) {
	JasperPrint jp = null;
	try {
		List<String> listaInventarnih = new ArrayList<String>();
		int odBr = Integer.parseInt(odInvBr.substring(4));
		String odeljenje = odInvBr.substring(0, 2);
		String tippubl = odInvBr.substring(2, 4);
		int doBr = Integer.parseInt(doInvBr.substring(4));
		for (int brojac = odBr; brojac <= doBr; brojac++) {
			String brojStr = String.valueOf(brojac);
			brojStr = "00000000000".substring(0, 7 - brojStr.length())
					+ brojStr;
			listaInventarnih.add(odeljenje + tippubl + brojStr);
		}
		CachingWrapperFilter filter = new CachingWrapperFilter(
				new BisisFilter(listaInventarnih));
		Result result = BisisApp.getRecordManager().selectAll3x(
				SerializationUtils.serialize(new MatchAllDocsQuery()),
				SerializationUtils.serialize(filter), null);
		Record[] records = BisisApp.getRecordManager().getRecords(result.getRecords());
		StringBuffer buff = new StringBuffer();
		
		for (Report r : reportCollection.getReports()) {
			
			if (!r.getReportSettings().getParam("menuitem").equalsIgnoreCase(reportName)) 
				continue;
			    buff.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
			    buff.append("<report>");
				r.init();
				for (Record rec : records) {
					r.handleRecord(rec);					
				}
				r.finishOnline(buff);
				buff.append("</report>");
				JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
						.getDocumentFromString(buff.toString()),
						"/report/item");
				Map param = new HashMap();
				if (r.getReportSettings().getParam("subjasper") != null) {
					JasperReport subreport = (JasperReport) JRLoader
							.loadObject(ReportRunner.class.getResource(
									r.getReportSettings().getParam(
											"subjasper")).openStream());
					param.put("subjasper", subreport);
				}
				jp = JasperFillManager.fillReport(ReportRunner.class
						.getResource(
								r.getReportSettings().getParam("jasper"))
						.openStream(), param, dataSource);
			}
		

	} catch (Exception e) {
		e.printStackTrace();
	}
	return jp;
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:58,代码来源:ReportRunner.java

示例6: setUp

import org.apache.lucene.search.CachingWrapperFilter; //导入依赖的package包/类
@Override
public void setUp() throws Exception {

    directory = new RAMDirectory();

    IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(Version.LUCENE_41),
            IndexWriter.MaxFieldLength.UNLIMITED);

    Calendar cal = Calendar.getInstance();
    cal.set(2009, 1, 1, 0, 0); 

    for (int i = 0; i < MAX; i++) {
        Document doc = new Document();
        doc.add(new Field("key", "" + (i + 1), Field.Store.YES, Field.Index.NOT_ANALYZED));
        doc.add(new Field("owner", (i < MAX / 2) ? "bob" : "sue", Field.Store.YES, Field.Index.NOT_ANALYZED));
        doc.add(new Field("date", DateTools.timeToString(cal.getTimeInMillis(), DateTools.Resolution.DAY),
                Field.Store.YES, Field.Index.NOT_ANALYZED));
        writer.addDocument(doc);

        cal.add(Calendar.DATE, 1);
    }

    writer.close();

    searcher = new IndexSearcher(directory);

    BooleanQuery bq = new BooleanQuery(); 
    bq.add(new TermQuery(new Term("owner", "bob")), 
            BooleanClause.Occur.SHOULD); 
    bq.add(new TermQuery(new Term("owner", "sue")), 
            BooleanClause.Occur.SHOULD); 
    query = bq;

    cal.set(2099, 1, 1, 0, 0);
    dateFilter = TermRangeFilter.Less("date",
            DateTools.timeToString(
                    cal.getTimeInMillis(),
                    DateTools.Resolution.DAY));// C

    bobFilter = new CachingWrapperFilter(
            new QueryWrapperFilter(
                    new TermQuery(new Term("owner", "bob"))));

    sueFilter = new CachingWrapperFilter(
            new QueryWrapperFilter(
                    new TermQuery(new Term("owner", "sue"))));
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:48,代码来源:ChainedFilterTest.java


注:本文中的org.apache.lucene.search.CachingWrapperFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。