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

  • Home
  • SEARCH
  • 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 492361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:06:16+00:00 2026-05-13T02:06:16+00:00

I created a website but i have a problem. i want to build once

  • 0

I created a website but i have a problem.
i want to build once an index und use it.

at the moment i have two functions “create a document an store it into the directory” and “searching”

when the user submit:

sub submit ()
    create_doc()
    search(text) 
end sub

this works, but when i try this:

create_doc()
sub submit()
   search(text)
end sub

it’s like the directory has been deleted.

global:
Dim analyzer As StandardAnalyzer = New StandardAnalyzer()Dim directory As Directory = FSDirectory.GetDirectory("C:\[...]luceneindex", True)
Dim indexwriter As IndexWriter = New IndexWriter(directory, analyzer, True)

Sub create_doc()
    Dim meindoc As New Document()
    im feldbodytext As Field = New Field("bodytext", textstring[...]
    meindoc.Add(feldbodytext)
    indexwriter.AddDocument(meindoc)
    indexwriter.Close()
end sub

Sub lucene_search(ByVal strSuchbegriff As String)
    Dim parser As QueryParser = New QueryParser("bodytext", analyzer)
    Dim query As Query = parser.Parse(strSuchbegriff)
    Dim hits As Hits = searcher.Search(query)
    [...]
end sub

Is there a possibility to store the index permanently?
could there be a problem init. the index writer gloabel, but close it local?

  • 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-05-13T02:06:16+00:00Added an answer on May 13, 2026 at 2:06 am

    I think your problem is that each time you declare your IndexWriter, the index is being re-created and the contents of the index erased – this is because of the 3rd parameter being passed into the constructor (True):

    Dim indexwriter As IndexWriter = New IndexWriter(directory, analyzer, True)
    

    You should instead use False, to indicate that the existing contents of the index should remain unchanged:

    Dim indexwriter As IndexWriter = New IndexWriter(directory, analyzer, False)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have created a website using Drupal , but the problem ( good problem
I have created a clickonce deployment and published it to a website. I want
I use Codeigniter to create a multilingual website and everything works fine, but when
I have a website where I want to use MagicZoom. Everything would be fine
I have created a pretty basic Flash website for a client and am having
I'm currently trying to build a personal website to create a presence on the
I have created a web application in that application i have added two folder.
On my website I want the user to have the ability to login/logout from
I don't know why this bothers me so much, but when I create websites,
I'm trying to run a freshly created ASP.NET Website using C#, however when I

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.