Package org.apache.lucene.document

Examples of org.apache.lucene.document.Document


            } else if( nntpRequest.getCommand().equalsIgnoreCase("xover") ) {
                nntpResponse.sendResponse( 224, "Header follows" );
                NewsGroup group = forum.getNewsgroup( nntpRequest.getCurrentNewsgroup() );
                Hits hits = forum.getOverview( group );
                for( int i = 0; i < hits.length(); i++ ) {
                    Document doc = hits.doc( i );
                    NntpOutputStream stream = nntpResponse.getOutputStream();
                    stream.print( doc.getField("article." + group.getName() + ".article-number").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.subject").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.from").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.date").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.message-id").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.references").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.bytes").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.lines").stringValue() );
                    stream.print( "\t" );
                    stream.print( doc.getField("article.xref").stringValue() );
                }
                nntpResponse.getOutputStream().printEnd();
//            } else if( nntpRequest.getCommand().equalsIgnoreCase("xhdr") ) {
//                for( int i = 0; i < nntpRequest.parameterLength(); i++ ) {
//                    System.out.println( nntpRequest.getParameter( i ) );
View Full Code Here


    action.setUserManager(new UserManager(getGnizrDao()));
    action.setUser(new User(1));
    action.setSession(session);
   
    String doc1Hash = "d1a8e491759cb30d11357c4776be9c66";
    Document d1 = searchIndexManager.findLeadDocument(doc1Hash);
    assertNull(d1);
   
    assertEquals(ActionSupport.SUCCESS, action.execute());
    Thread.sleep(10000);
    d1 = searchIndexManager.findLeadDocument(doc1Hash);
View Full Code Here

    bookmarkPager = new BookmarkPager(getGnizrDao());
   
    DaoResult<Bookmark> result = bookmarkPager.pageAllBookmark(new User(2));
    List<Bookmark> bmarks = result.getResult();
    for(Bookmark bm : bmarks){
      Document doc = DocumentCreator.createDocument(bm);     
      searchIndexManager.addIndex(doc);
    }
   
    result = bookmarkPager.pageAllBookmark(new User(3));
    bmarks = result.getResult();
   
    for(Bookmark bm : bmarks){
      Document doc = DocumentCreator.createDocument(bm);
      searchIndexManager.addIndex(doc);
    }
   
    Thread.sleep(10000);
  }
View Full Code Here

    SolrDocument doc = new SolrDocument();
    if (returnFields!=null){
      for (String fld : returnFields){
      String[] fv = hit.getFields(fld);
      if (fv==null){
        Document storedFields = hit.getStoredFields();
        if (storedFields!=null){
          fv = storedFields.getValues(fld);
        }
      }
      if (fv!=null){
        doc.addField(fld, fv);
      }
View Full Code Here

        boboBrowser=newBrowser();
       
          result = boboBrowser.browse(br);
          assertEquals(1,result.getNumHits());
          BrowseHit hit = result.getHits()[0];
          Document storedFields = hit.getStoredFields();
          assertNotNull(storedFields);
         
          String[] values = storedFields.getValues("testStored");
          assertNotNull(values);
          assertEquals(1, values.length);
          assertTrue("stored".equals(values[0]));
         
      } catch (BrowseException e) {
View Full Code Here

         
          br.setFetchStoredFields(true);
          result = boboBrowser.browse(br);
          assertEquals(1,result.getNumHits());
          hit = result.getHits()[0];
          Document storedFields = hit.getStoredFields();
          assertNotNull(storedFields);
         
          String stored = storedFields.get("testStored");
          assertTrue("stored".equals(stored));
         
      } catch (BrowseException e) {
        e.printStackTrace();
        fail(e.getMessage());
View Full Code Here

    IndexReader idxReader = IndexReader.open(idxDir,true);
    BoboIndexReader boboReader = BoboIndexReader.getInstance(idxReader,_fconf);

   
    for (int i=1;i<docs.length;++i){
      Document doc = docs[i];
      int numDocs = boboReader.numDocs();
      BoboIndexReader reader = (BoboIndexReader)boboReader.reopen(true);
      assertSame(boboReader,reader);
     
      Directory tmpDir = new RAMDirectory();
View Full Code Here

   
    long now = System.currentTimeMillis();
    DecimalFormat df = new DecimalFormat(DynamicTimeRangeFacetHandler.NUMBER_FORMAT);
    for(long l=0; l<53; l++)
    {
      Document d = new Document();
      d.add(buildMetaField("timeinmillis", df.format(now - l*3500000)));
      writer.addDocument(d);
      writer.optimize();
      writer.commit();
    }
    IndexReader idxReader = IndexReader.open(idxDir,true);
View Full Code Here

  @Override
  protected void setUp() throws Exception {
      directory = new RAMDirectory();
      analyzer = new WhitespaceAnalyzer();
      IndexWriter writer = new IndexWriter(directory, analyzer, true, MaxFieldLength.UNLIMITED);
      Document doc = new Document();
      addMetaDataField(doc,PathHandlerName,new String[]{"/a/b/c","/a/b/d"});
      writer.addDocument(doc);
      writer.commit();
     
      PathFacetHandler pathHandler = new PathFacetHandler("path",true);
View Full Code Here

    public Document buildDocument()
    {
      HashMap<String,String> data = _prop.getData();
      if (data!=null)
      {
        Document doc = new Document();
        Set<String> keySet = data.keySet();
        Iterator<String> keyIter = keySet.iterator();
        StringBuffer contentBuffer = new StringBuffer();
        while(keyIter.hasNext())
        {
          String propName = keyIter.next();
          String propVal = data.get(propName);
          contentBuffer.append(propVal).append(" ");
          String[] valList = propVal.split(",");
          for (String val : valList)
          {
            Field f = new Field(propName,val,Store.NO,Index.NOT_ANALYZED_NO_NORMS);
            f.setOmitTermFreqAndPositions(true);
            doc.add(f);
          }
          doc.add(new Field(CONTENTS_FIELD_NAME,contentBuffer.toString(),Store.NO,Index.ANALYZED));
        }
        return doc;
      }
      else
      {
View Full Code Here

TOP

Related Classes of org.apache.lucene.document.Document

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.