Hot questions for Using Cassandra in lucene


I am just experimenting with Lucene and want to indexing objects in Database(Cassandra) as a table. But, I didnt realized out, how the indexing does work on Cassandra. Especially searching...

When i take a simple Example

Indexing in Lucene:

Document doc = new Document();
doc.add(new TextField("id", "Hotel-1345", Field.Store.YES));
doc.add(new TextField("description", "A beautiful hotel", Field.Store.YES));

then Lucene will create index File (C:..) And Querying works well, with indexSearcher. But...

Indexing Database? I think i cant just create a simple table like that

ID        , Description
Hotel-1345, A beautiful hotel

How does the searching process of lucene works? How should the database structur be?

hope, i get some answers :/


It will not look like a relational database table, instead Lucene uses the inverted index and cosine similarity formula for searching of any search words.

To better understand you need to look for various terminology and formula to be used in lucene, you can check out it on lucene officially website,

To index data you need to make use of the Lucene indexer and searcher API use this pseudo code for indexing :

    Directory directory = null;
    IndexWriter writer = null;
    try {
        directory = File(args[0]));
        IndexWriterConfig iwConf = new IndexWriterConfig(Version.LUCENE_48,
                new KeywordAnalyzer());
        writer = new IndexWriter(directory, iwConf);
        Document document = new Document();
        document.add(new StringField("title", "Cat", Store.YES));
    } catch (IOException e) {