src/main/java/ch/uzh/ifi/seal/ase/cscc/index/AbstractInvertedIndex.java
void addDocToLuceneIndex(IndexDocument doc) throws IOException {
        Document luceneDoc = new Document();
        docIdField.setStringValue(doc.getId());
        luceneDoc.add(docIdField);
        typeField.setStringValue(doc.getType());
        luceneDoc.add(typeField);
        // store all terms in the overall context as tokens in the index
        // StringField: no tokenization
        // TextField: tokenization
        for (String term : doc.getOverallContext()) {
            StringField overallContextField = new StringField(OVERALL_CONTEXT_FIELD, term, Field.Store.NO);
            luceneDoc.add(overallContextField);
        }
//        indexWriter.addDocument(luceneDoc); // this will add duplicates to an existing index
        indexWriter.updateDocument(new Term(DOC_ID_FIELD, doc.getId()), luceneDoc); // don't index docs with same docID twice
    }
/**
     * Stores docID and the overall context in the Lucene index. The overall context will be what we search for at
     * retrieval time, the docID will be the result of the retrieval.
     *
     * @param doc The document that should be added to the index
     * @throws IOException
     */
Stores docID and the overall context in the Lucene index. The overall context will be what we search for at
retrieval time, the docID will be the result of the retrieval.

@param doc The document that should be added to the index
@throws IOException
Stores docID and the overall context in the Lucene index . The overall context will be what we search for at retrieval time the docID will be the result of the retrieval . @param doc The document that should be added to the index @throws IOException
void addDocToLuceneIndex(IndexDocument doc) throws IOException {
        Document luceneDoc = new Document();
        docIdField.setStringValue(doc.getId());
        luceneDoc.add(docIdField);
        typeField.setStringValue(doc.getType());
        luceneDoc.add(typeField);
        for (String term : doc.getOverallContext()) {
            StringField overallContextField = new StringField(OVERALL_CONTEXT_FIELD, term, Field.Store.NO);
            luceneDoc.add(overallContextField);
        }
        indexWriter.updateDocument(new Term(DOC_ID_FIELD, doc.getId()), luceneDoc); 
    }
void addDocToLuceneIndex ( IndexDocument doc ) throws IOException { Document luceneDoc = new Document ( ) ; docIdField . setStringValue ( doc . getId ( ) ) ; luceneDoc . add ( docIdField ) ; typeField . setStringValue ( doc . getType ( ) ) ; luceneDoc . add ( typeField ) ; for ( String term : doc . getOverallContext ( ) ) { StringField overallContextField = new StringField ( OVERALL_CONTEXT_FIELD , term , Field . Store . NO ) ; luceneDoc . add ( overallContextField ) ; } indexWriter . updateDocument ( new Term ( DOC_ID_FIELD , doc . getId ( ) ) , luceneDoc ) ; }
Stores docID and the overall context in the Lucene index.
Stores docID and the overall context in the Lucene index .
// store all terms in the overall context as tokens in the index // StringField: no tokenization // TextField: tokenization //        indexWriter.addDocument(luceneDoc); // this will add duplicates to an existing index // don't index docs with same docID twice