lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Serebrennikov <dmit...@earthlink.net>
Subject Re: I'm new in lucene and I have some questions....
Date Wed, 07 Nov 2001 22:32:34 GMT
"segments" is one of the files that Lucene creates in its index 
directory. When index reader is created, it tries to open and existing 
index. The first file it goes after is "segments". So the directory 
given to IndexSearcher should point to an existing lucene index 
directory (which should be created with IndexWriter prior to this).

It looks like in the code below you should pass indexPath into 
IndexSearcher constructor instead of "C:\\". Also, there should be a 
previously created index in the C:\\lucena directory.  The index that 
this program expects is one created by the file indexing demo, it looks 
like, because it expects to search the field "body" and have a field 
"path" in each document.

Unfortunately, demos have not been updated recently and the jhtml stuff 
in particular has been already old even a year ago! If you feel like 
updating the programs as you figure them out and then contributing the 
code, I think you will get lot's of help on the list and your work will 
also be very much appreciated by the current developers and future users.

(PS: I found the javadocs pretty helpful in figuring out what's going on 
and also browsing through the high level classes sources code was 
helpful as well. I would recommend looking at org.apache.lucene.search 
package first.)

Cheers.
Dmitry.


Jaume Homs wrote:

>Hi!
>I've downlaoad lucene and after some work, compile it.
>Now I want to try it.
>The search.html call a search.jhtml that my servlet engine doesn't
>understand.
>I've modified the search.jhtml and now I have a search.jsp but I get this:
>
>Method getReader(java.lang.String) not found in jsp._Search__jsp.
>    new IndexSearcher(getReader(indexName));
>
>
>Then I found this source code:
>
>
>public class lucena {
>  public static void main() {
>
>        try{
>    String indexPath = "c:\\lucena", queryString = "la";
>
>
>     System.out.println("1");
>
>
>    Searcher searcher = new IndexSearcher("c:\\");
>    System.out.println("2");
>    Query query = QueryParser.parse(queryString, "body",new
>SimpleAnalyzer());
>    System.out.println("3");
>    Hits hits = searcher.search(query);
>System.out.println("4");
>    for (int i=0; i<hits.length(); i++) {
>      System.out.println(hits.doc(i).get("path") + "; Score: " +
>                         hits.score(i));
>        }
>        }
>        catch(Exception e)
>        {
>                System.out.println(e.getMessage());
>        }
>  }
>}
>
>
>
>But I get the following error: C:\segments (The system cannot find the file
>specified)
>c:\segments??? What is it??
>I've create the segments directory, the I get the following error:
>C:\segments (Access is denied)
>
>Where can I find some example???  Can some one help me please??
>
>
>
>
>Jaume Homs | Technical Leader
>
>Lost Boys Spain | Diputació, 246 | 08007 Barcelona España | www.lostboys.es
>jaume.homs@lostboys.es | ICQ: 97362231 | Tel: +34 93 4457200 | Fax: +34 93
>4457220
>
>Amsterdam | Barcelona | Berlin | London | Madrid | Paris | San Francisco |
>Warsaw | Zurich
>
>
>
>
>----------------------------------- //
>La información transmitida en este mensaje es CONFIDENCIAL y está dirigida
>únicamente al destinatario del mensaje arriba indicado. No puede ser
>transmitida ni revelada a persona distinta del destinatario sin autorización
>expresa del remitente.
>La recepción de este mensaje, por cualquier causa, por persona distinta al
>destinatario del mismo no le autoriza para hacer uso alguno de la
>información. En este caso queda prohibida, y puede ser ilícita, cualquier
>divulgación, copia, distribución y/o cualquier uso de la información. Le
>rogamos borre inmediatamente el mensaje de su sistema y, en su caso, todas
>las copias del mismo y lo notifique al remitente. Gracias.
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message