[siren-user] Error in NTriplesIndexing demo

rajashree deka rajashree.deka at gmail.com
Sat Oct 8 14:55:08 IST 2011


Hi,

When I am running the NTriplesIndexing demo, I get an error for the
NTriplesIndexing method. Below is the code. Is it because
MaxFieldLength is deprecated? What do I use instead then?
http://lucene.apache.org/java/3_1_0/api/core/org/apache/lucene/index/IndexWriter.html
tells me to use LimitTokenCountAnalyzer instead. But how to use this?

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.store.RAMDirectory;
import org.sindice.siren.analysis.TupleAnalyzer;
import org.sindice.siren.search.SirenCellClause;
import org.sindice.siren.search.SirenCellQuery;
import org.sindice.siren.search.SirenPhraseQuery;
import org.sindice.siren.search.SirenTermQuery;
import org.sindice.siren.search.SirenTupleClause;
import org.sindice.siren.search.SirenTupleQuery;

/**
 * A demo that shows how to index and query plain N-Triples documents.
 */
public class NTriplesIndexing {

  public RAMDirectory  dir;

  public IndexWriter   writer;

  public IndexReader   reader;

  public static final String DEFAULT_FIELD = "content";

  public NTriplesIndexing()
  throws CorruptIndexException, LockObtainFailedException, IOException {
    dir = new RAMDirectory();
    writer = new IndexWriter(dir, new TupleAnalyzer(),
MaxFieldLength.UNLIMITED);
    reader = IndexReader.open(dir, true);
  }


If possible, can you please upload some recent examples. Most of the
stuff is deprecated and for beginners like me, it is very difficult to
understand.

Thanks in advance.

Rajashree


More information about the siren mailing list