Package org.apache.lucene.document

Examples of org.apache.lucene.document.Document


  }

  //*-- create the Lucene Index
  public void loadIndex(IndexWriter ramIW, boolean storeTermVector) throws IOException
  {
   Document doc = new Document();
   doc.add( new Field("key", getFileName(), Field.Store.YES, Field.Index.NO) );
   doc.add(new Field("contents", getContents().toString(), Field.Store.NO, Field.Index.TOKENIZED) );
   doc.add( new Field("type", getFileType(), Field.Store.YES, Field.Index.NO) );
   doc.add( new Field("category", getTextType(), Field.Store.YES, Field.Index.NO) );
   ramIW.addDocument(doc);
  }
View Full Code Here


     for (int j = 0; j < ranks.length; j++) if (ranks[j] == i) foundHit = true;
     if (!foundHit) continue LOOP;
    
     retv.append("Document: " + i + Constants.NEWLINE);
     explanation = is.explain(query, hits.id(i))
     Document doc = hits.doc(i);
     String key = doc.get("key");
     DatabaseEntry data = new DatabaseEntry();
     if (!dbt.fetch(key, data)) continue LOOP;

     //*-- extract the text
     IndexableDoc idoc = new IndexableDoc();
View Full Code Here

   setTextType(cdoc.classifyTextContents(this)); }

//*-- create the Lucene Index
public void loadIndex(IndexWriter ramIW, boolean storeTermVector) throws IOException
{
  Document doc = new Document();
  doc.add( new Field("key", getFileName(), Field.Store.YES, Field.Index.NO) );
  doc.add(new Field("contents", getContents().toString(), Field.Store.NO, Field.Index.TOKENIZED) );
  doc.add( new Field("type", getFileType(), Field.Store.YES, Field.Index.NO) );
  doc.add( new Field("category", getTextType(), Field.Store.YES, Field.Index.NO) );
  ramIW.addDocument(doc);
}
View Full Code Here

  }

  //*-- create the Lucene Index
  public void loadIndex(IndexWriter ramIW, boolean storeTermVector) throws IOException
  {
   Document doc = new Document();
   doc.add( new Field("key", getFileName(), Field.Store.YES, Field.Index.NO) );
   doc.add(new Field("contents", getContents().toString(), Field.Store.NO, Field.Index.TOKENIZED) );
   doc.add( new Field("type", getFileType(), Field.Store.YES, Field.Index.NO) );
   doc.add( new Field("category", getTextType(), Field.Store.YES, Field.Index.NO) );
   ramIW.addDocument(doc);
  }
View Full Code Here

   DbTools dbt = Constants.getDbt();
   if (hits.length() == 0results[j++] = " Try " + getAlt();
   LOOP: for (int i = 0; i < hits.length(); i++)
   {
    //*-- use the key to fetch the matching database entry
    Document doc = hits.doc(i);
    String key = doc.get("key");
    String ftype = doc.get("type");
    DatabaseEntry data = new DatabaseEntry();

    String dbname = (ftype.equalsIgnoreCase("email")) ? Constants.EXT_MESSAGES_DB: Constants.EXT_FILES_DB;
    dbt.openDB(dbname, true, false); //*-- no create and no dups            
    dbt.fetch(key, data);
View Full Code Here

   * @param type
   */
  public SearchDocument(T type) {
    Assert.isLegal(type != null);
    fType = type;
    fDocument = new Document();
  }
View Full Code Here

      final List<SearchHit<NewsReference>> resultList = new ArrayList<SearchHit<NewsReference>>();
      HitCollector collector = new HitCollector() {
        @Override
        public void collect(int doc, float score) {
          try {
            Document document = fSearcher.doc(doc);

            /* Receive Stored Fields */
            long newsId = Long.valueOf(document.get(SearchDocument.ENTITY_ID_TEXT));
            INews.State newsState = NEWS_STATES[Integer.parseInt(document.get(NewsDocument.STATE_ID_TEXT))];

            Map<Integer, INews.State> data = new HashMap<Integer, INews.State>(1);
            data.put(INews.STATE, newsState);

            /* Add to List */
 
View Full Code Here

   * @param type
   */
  public SearchDocument(T type) {
    Assert.isLegal(type != null);
    fType = type;
    fDocument = new Document();
  }
View Full Code Here

      /* Use custom hit collector for performance reasons */
      HitCollector collector = new HitCollector() {
        @Override
        public void collect(int doc, float score) {
          try {
            Document document = currentSearcher.doc(doc);

            /* Receive Stored Fields */
            long newsId = Long.parseLong(document.get(SearchDocument.ENTITY_ID_TEXT));
            INews.State newsState = NEWS_STATES[Integer.parseInt(document.get(NewsDocument.STATE_ID_TEXT))];

            Map<Integer, INews.State> data = new HashMap<Integer, INews.State>(1);
            data.put(INews.STATE, newsState);

            /*
 
View Full Code Here

    }

    @Override
    public void collect(int doc, float score) {
      try {
        Document document = fSearcher.doc(doc);

        /* Receive Stored Fields */
        long newsId = Long.parseLong(document.get(SearchDocument.ENTITY_ID_TEXT));

        /*
         * Under some circumstances the index might contain the same news twice.
         * This can happen in situations where RSSOwl is quitting in an emergent
         * way (e.g. the OS shutting down while RSSOwl is running). To avoid
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.