Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9276195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:47:01+00:00 2026-06-18T16:47:01+00:00

Here’s my code: import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import

  • 0

Here’s my code:

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import org.apache.lucene.index.CorruptIndexException;

public class Main 
{
    public static void main()
    {
        //Index index = new Index();
        String[] titleAndContent = parseFile("files/methode.txt");
        Index index = new Index("files",null);
        try 
        {
            index.openIndex(true);
            index.addDocument(titleAndContent[0], titleAndContent[1], "files/methode.txt");
        } 
        catch (CorruptIndexException e) 
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
        catch (IOException e) 
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    public static String[] parseFile(String path)
    {
        String[] titleAndContent = new String[2];
        File file = new File(path);
        try 
        {
            FileReader fr = new FileReader(file); 
            BufferedReader br = new BufferedReader(fr); 
            String line = new String();
            String content = new String();
            try 
            {
                while((line = br.readLine()) != null) 
                { 
                     if (line.substring(0,min(6,line.length())).equals("title:"))
                     {
                         titleAndContent[0] = line.substring(6,line.length());
                     }
                     else
                     {
                         if (line.substring(0,min(8,line.length())).equals("content:"))
                         {
                             content += line.substring(8,line.length())+"\n";
                         }
                         else
                         {
                             content += line+"\n";
                         }
                     }
                }
            } 
            catch (IOException e1) 
            {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            titleAndContent[1] = content;
            try 
            {
                fr.close();
            } 
            catch (IOException e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } 
        catch (FileNotFoundException e) 
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return titleAndContent;
    }

    public static int max (int a, int b)
    {
        if (a<b)
        {
            return b;
        }
        return a;
    }

    public static int min (int a, int b)
    {
        if (a<b)
        {
            return a;
        }
        return b;
    }
}

The problem is, I can’t compile my Lucene projet under Eclipse. It keeps telling me:

ERROR: index path not specified

Usage: java org.apache.lucene.index.CheckIndex pathToIndex [-fix] [-segment X] [-segment Y]

  -fix: actually write a new segments_N file, removing any problematic segments
  -segment X: only check the specified segments.  This can be specified multiple
              times, to check more than one segment, eg '-segment _2 -segment _a'.
              You can't use this with the -fix option

**WARNING**: -fix should only be used on an emergency basis as it will cause
documents (perhaps many) to be permanently removed from the index.  Always make
a backup copy of your index before running this!  Do not run this tool on an index
that is actively being written to.  You have been warned!

Run without -fix, this tool will open the index, report version information
and report any exceptions it hits and what action it would take if -fix were
specified.  With -fix, this tool will remove any segments that have issues and
write a new segments_N file.  This means all documents contained in the affected
segments will be removed.

This tool exits with exit code 1 if the index cannot be opened or has any
corruption, else 0.

I tried everything to make it work, and as the whole web says, I used

-ea:org.apache.lucene... pathToIndex -fix

as argument of compilation. But whatever I put instead of pathToIndex, it keeps telling me

Unexpected argument pathToIndex (or whatever instead)

How can I get this f… project work?
Thank you in advance.

Edit: Of course I’ve imported all Lucene JARs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:47:02+00:00Added an answer on June 18, 2026 at 4:47 pm

    Actually, I started the project over by creating a simple Main class and a main method inside it and tried to compile it immediately. And it worked fine, this time. Note you should show the Main class on your screen tab before compiling in Eclipse.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the code I have. This is my PrintToFile class import java.util.*; import
Here is my context file.: <beans default-lazy-init=true xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:tx=http://www.springframework.org/schema/tx xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>
Here is the code in a function I'm trying to revise. This example works
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
Here's my code: NSDate *currDate = [NSDate date]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; [dateFormatter
Here is my code and I expect it prints out a number, instead, it
Here is the code I'm using http://jsbin.com/evike5/edit When the jQuery UI dialog is fired
Here's some of my production code (I had to force line breaks): task =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.