FAQ
Hi everybody,
I've a problem with my searching index.
I've created a stand alone application and it works perfectly.
I've put them on tomcat launching with java web start,but if I run the
query(the same query) I always obtain no results!!!Why??
Obviously My tomcat app is looking at the same index from my standalone
app.
I've tried to put the index everywhere but the result is always the
same.
Please help me!!!
Marco Lazzara






---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Search Discussions

  • Uwe Schindler at May 18, 2009 at 5:20 pm
    If it is a webstart app, how do you distribute the index. The webstart app
    is downloaded to the user's computer and executed there. The index is not
    transferred on webapp download, if it is not included in the JAR file.
    Opening indexes from within JAR files (using Class.getResourceAsStream) is
    not supported by Lucene. So your application must first download the index
    somehow from your server and e.g. store it in a RAMDirectory or a temp
    folder.

    Uwe

    -----
    Uwe Schindler
    H.-H.-Meier-Allee 63, D-28213 Bremen
    http://www.thetaphi.de
    eMail: uwe@thetaphi.de
    -----Original Message-----
    From: Marco Lazzara
    Sent: Monday, May 18, 2009 7:13 PM
    To: java-user@lucene.apache.org
    Subject: Searching index problems with tomcat

    Hi everybody,
    I've a problem with my searching index.
    I've created a stand alone application and it works perfectly.
    I've put them on tomcat launching with java web start,but if I run the
    query(the same query) I always obtain no results!!!Why??
    Obviously My tomcat app is looking at the same index from my standalone
    app.
    I've tried to put the index everywhere but the result is always the
    same.
    Please help me!!!
    Marco Lazzara






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 18, 2009 at 5:42 pm
    I've put the index in a folder named
    RDFIndexLucene(home/marco/RDFIndexLucene), and when i run the query,(for
    example) if I delete the folder Tomcat says :"no segments* file found in
    org.apache.lucene.store.FSDirectory@/home/marco/RDFIndexLucene"
    It means that Lucene try to search in the index but with no result!
    N.B My app isn't a really web app because i create the .war file with
    ANT APACHE .
    Any ideas?




    Il giorno lun, 18/05/2009 alle 19.20 +0200, Uwe Schindler ha scritto:
    If it is a webstart app, how do you distribute the index. The webstart app
    is downloaded to the user's computer and executed there. The index is not
    transferred on webapp download, if it is not included in the JAR file.
    Opening indexes from within JAR files (using Class.getResourceAsStream) is
    not supported by Lucene. So your application must first download the index
    somehow from your server and e.g. store it in a RAMDirectory or a temp
    folder.

    Uwe

    -----
    Uwe Schindler
    H.-H.-Meier-Allee 63, D-28213 Bremen
    http://www.thetaphi.de
    eMail: uwe@thetaphi.de
    -----Original Message-----
    From: Marco Lazzara
    Sent: Monday, May 18, 2009 7:13 PM
    To: java-user@lucene.apache.org
    Subject: Searching index problems with tomcat

    Hi everybody,
    I've a problem with my searching index.
    I've created a stand alone application and it works perfectly.
    I've put them on tomcat launching with java web start,but if I run the
    query(the same query) I always obtain no results!!!Why??
    Obviously My tomcat app is looking at the same index from my standalone
    app.
    I've tried to put the index everywhere but the result is always the
    same.
    Please help me!!!
    Marco Lazzara






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Ian Lea at May 19, 2009 at 8:22 am
    So you say it isn't really a webapp, and it appears that it isn't a
    webstart app either since the index is sitting in a local folder. But
    you are deploying a .war file into tomcat, right?

    Has tomcat got the same libraries as your standalone app? What do the
    tomcat logs say? Any exceptions? Are you sure the query is the same
    - what does toString() say? Are you sure the index is the same - what
    do IndexReader.maxDoc(), numDocs() and getVersion() say, standalone
    and in tomcat?


    --
    Ian.
    On Mon, May 18, 2009 at 6:41 PM, Marco Lazzara wrote:
    I've put the index in a folder named
    RDFIndexLucene(home/marco/RDFIndexLucene), and when i run the query,(for
    example) if I delete the folder Tomcat says :"no segments* file found in
    org.apache.lucene.store.FSDirectory@/home/marco/RDFIndexLucene"
    It means that Lucene try to search in the index but with no result!
    N.B My app isn't a really web app because i create the .war file with
    ANT APACHE .
    Any ideas?




    Il giorno lun, 18/05/2009 alle 19.20 +0200, Uwe Schindler ha scritto:
    If it is a webstart app, how do you distribute the index. The webstart app
    is downloaded to the user's computer and executed there. The index is not
    transferred on webapp download, if it is not included in the JAR file.
    Opening indexes from within JAR files (using Class.getResourceAsStream) is
    not supported by Lucene. So your application must first download the index
    somehow from your server and e.g. store it in a RAMDirectory or a temp
    folder.

    Uwe

    -----
    Uwe Schindler
    H.-H.-Meier-Allee 63, D-28213 Bremen
    http://www.thetaphi.de
    eMail: uwe@thetaphi.de
    -----Original Message-----
    From: Marco Lazzara
    Sent: Monday, May 18, 2009 7:13 PM
    To: java-user@lucene.apache.org
    Subject: Searching index problems with tomcat

    Hi everybody,
    I've a problem with my searching index.
    I've created a stand alone application and it works perfectly.
    I've put them on tomcat launching with java web start,but if I run the
    query(the same query) I always obtain no results!!!Why??
    Obviously My tomcat app is looking at the same index from my standalone
    app.
    I've tried to put the index everywhere but the result is always the
    same.
    Please help me!!!
    Marco Lazzara






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 19, 2009 at 12:32 pm
    _*you are deploying a .war file into tomcat, right?*_

    Yes.With apache ant you can create a .war file.

    _*Has tomcat got the same libraries as your standalone app?*_


    Tomcat has got lucene-core-2.4.0,lucene-wordnet-2.4.0,swt.jar,but it
    hasn't got libraries like jena,jenatest,commons-logging-1.1.1 because
    there are useless.

    _* What do the tomcat logs say? Any exceptions?
    *_
    There are no exceptions.When I run the query a new shell is displayed but with no result.


    _*Are you sure the query is the same?
    *_
    Yes I'm sure.


    _*Are you sure the index is the same - what do IndexReader.maxDoc(), numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??


    P.S: I've followed a getting started topic on lucene web page http://lucene.apache.org/java/2_4_1/demo.html

    But with not satisfaction result.


    Marco Lazzara
    So you say it isn't really a webapp, and it appears that it isn't a
    webstart app either since the index is sitting in a local folder. But
    you are deploying a .war file into tomcat, right?

    Has tomcat got the same libraries as your standalone app? What do the
    tomcat logs say? Any exceptions? Are you sure the query is the same
    - what does toString() say? Are you sure the index is the same - what
    do IndexReader.maxDoc(), numDocs() and getVersion() say, standalone
    and in tomcat?


    --
    Ian.
    On Mon, May 18, 2009 at 6:41 PM, Marco Lazzara wrote:

    I've put the index in a folder named
    RDFIndexLucene(home/marco/RDFIndexLucene), and when i run the query,(for
    example) if I delete the folder Tomcat says :"no segments* file found in
    org.apache.lucene.store.FSDirectory@/home/marco/RDFIndexLucene"
    It means that Lucene try to search in the index but with no result!
    N.B My app isn't a really web app because i create the .war file with
    ANT APACHE .
    Any ideas?




    Il giorno lun, 18/05/2009 alle 19.20 +0200, Uwe Schindler ha scritto:
    If it is a webstart app, how do you distribute the index. The webstart app
    is downloaded to the user's computer and executed there. The index is not
    transferred on webapp download, if it is not included in the JAR file.
    Opening indexes from within JAR files (using Class.getResourceAsStream) is
    not supported by Lucene. So your application must first download the index
    somehow from your server and e.g. store it in a RAMDirectory or a temp
    folder.

    Uwe

    -----
    Uwe Schindler
    H.-H.-Meier-Allee 63, D-28213 Bremen
    http://www.thetaphi.de
    eMail: uwe@thetaphi.de

    -----Original Message-----
    From: Marco Lazzara
    Sent: Monday, May 18, 2009 7:13 PM
    To: java-user@lucene.apache.org
    Subject: Searching index problems with tomcat

    Hi everybody,
    I've a problem with my searching index.
    I've created a stand alone application and it works perfectly.
    I've put them on tomcat launching with java web start,but if I run the
    query(the same query) I always obtain no results!!!Why??
    Obviously My tomcat app is looking at the same index from my standalone
    app.
    I've tried to put the index everywhere but the result is always the
    same.
    Please help me!!!
    Marco Lazzara






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4085 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4086 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Ian Lea at May 19, 2009 at 3:53 pm

    ...
    There are no exceptions.When I run the query a new shell is displayed but
    with no result.
    New shell?
    _*Are you sure the index is the same - what do IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Matthew Hall at May 19, 2009 at 4:01 pm
    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from both
    apps.

    Could you further post the document creation code used at indexing time?
    (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:
    ...
    There are no exceptions.When I run the query a new shell is displayed but
    with no result.
    New shell?

    _*Are you sure the index is the same - what do IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 19, 2009 at 10:51 pm
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {

    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;

    //private RDFinder rdfind = new RDFinder("RDFIndexLucene/",new
    String[] {"name"});

    // public boolean Exists(String node) throws ParseException, IOException{
    //
    // return rdfind.Exists(node);
    // }

    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{

    commonnodes = new ArrayList<String>();

    // bisogna istanziare un oggetto per fare analisi sul documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);


    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();

    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");

    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:

    //Directory directory = new RAMDirector();

    //Memorizza l'indice su file

    directory = FSDirectory.getDirectory("RDFIndexLucene/");

    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));


    //costruiamo un indice con solo n documenti: un documento per nodo

    for (int i = 0; i < nodesize; i++){

    Document doc = new Document();

    //creazione dei vari campi

    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e indicizzazione
    con analyzer(ANALYZED)

    String node = nodelist.get(i);

    //if (sourcelist.contains(node)) break;

    //if (rdfind.Exists(node)) commonnodes.add(node);

    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);

    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {

    field = new Field("synonyms", nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }

    // uno o piu campi path_i: path minimali dalle sorgenti al nodo
    // non indicizzati

    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{

    if ((source.equals(node)) || (sourcelist.contains(node))){
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp, Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }

    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node: "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }



    }

    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi

    ArrayList<String> y = rs.getInProperty(node);

    if (y != null) {

    for (int j = 0; j < y.size(); j++) {

    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);


    String[] propinsynonyms = wns.getSynonyms(propin);

    for (int is = 0; is < propinsynonyms.length; is++) {

    field = new Field("propIn", propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }

    }

    // un campo num_propIn: numero di proprietˆ entranti
    // non indicizzato

    String num_propIN = String.valueOf(y.size());

    field = new Field("num_propIn", num_propIN, Field.Store.YES,
    Field.Index.NO);
    doc.add(field);

    }

    else {

    String num_propIN = String.valueOf(0);

    field = new Field("num_propIn", num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);

    }

    // i vicini del nodo

    ArrayList<String> v = rs.getVicini(node);

    if (v != null) {

    for (int j = 0; j < v.size(); j++) {

    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);

    }

    }



    //aggiunta documento all'indice
    iwriter.addDocument(doc);
    }

    iwriter.close();
    directory.close();

    }

    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA
    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:
    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?

    _*Are you sure the index is the same - what do IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Matthew Hall at May 19, 2009 at 9:59 pm
    Sorry, anyhow looking over this quickly here's a summarization of what I
    see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to be
    a by reference fashion (You don't have a fully qualified path to where
    your index is, you are ASSUMING that its in the same directory as this
    code, unless FSDirectory is not implemented as I think it is.)

    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war file
    into tomcat, and its just not really finding the index as a result of
    how the war file is getting deployed, but looking more closely at the
    source code should reveal if my suspicion is correct here.

    Also runtime wise, when you run your standalone app, where specifically
    in your directory structure are you running it from? Cause if you are
    opening your index reader/searcher in the same way as you are creating
    your writer here, I'm pretty darn certain that will cause you problems.

    Matt



    Marco Lazzara wrote:
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {

    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;

    //private RDFinder rdfind = new RDFinder("RDFIndexLucene/",new
    String[] {"name"});

    // public boolean Exists(String node) throws ParseException, IOException{
    //
    // return rdfind.Exists(node);
    // }

    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{

    commonnodes = new ArrayList<String>();

    // bisogna istanziare un oggetto per fare analisi sul documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);


    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();

    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");

    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:

    //Directory directory = new RAMDirector();

    //Memorizza l'indice su file

    directory = FSDirectory.getDirectory("RDFIndexLucene/");

    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));


    //costruiamo un indice con solo n documenti: un documento per nodo

    for (int i = 0; i < nodesize; i++){

    Document doc = new Document();

    //creazione dei vari campi

    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e indicizzazione
    con analyzer(ANALYZED)

    String node = nodelist.get(i);

    //if (sourcelist.contains(node)) break;

    //if (rdfind.Exists(node)) commonnodes.add(node);

    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);

    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {

    field = new Field("synonyms", nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }

    // uno o piu campi path_i: path minimali dalle sorgenti al nodo
    // non indicizzati

    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{

    if ((source.equals(node)) || (sourcelist.contains(node))){
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp, Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }

    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node: "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }



    }

    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi

    ArrayList<String> y = rs.getInProperty(node);

    if (y != null) {

    for (int j = 0; j < y.size(); j++) {

    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);


    String[] propinsynonyms = wns.getSynonyms(propin);

    for (int is = 0; is < propinsynonyms.length; is++) {

    field = new Field("propIn", propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }

    }

    // un campo num_propIn: numero di proprietˆ entranti
    // non indicizzato

    String num_propIN = String.valueOf(y.size());

    field = new Field("num_propIn", num_propIN, Field.Store.YES,
    Field.Index.NO);
    doc.add(field);

    }

    else {

    String num_propIN = String.valueOf(0);

    field = new Field("num_propIn", num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);

    }

    // i vicini del nodo

    ArrayList<String> v = rs.getVicini(node);

    if (v != null) {

    for (int j = 0; j < v.size(); j++) {

    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);

    }

    }



    //aggiunta documento all'indice
    iwriter.addDocument(doc);
    }

    iwriter.close();
    directory.close();

    }

    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA

    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:
    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?


    _*Are you sure the index is the same - what do IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 20, 2009 at 8:59 am
    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara
    Sorry, anyhow looking over this quickly here's a summarization of what
    I see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it is.)

    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory = FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti: un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node)) commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp, Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node: "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN = String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA

    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:
    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?


    _*Are you sure the index is the same - what do IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Ian Lea at May 20, 2009 at 12:50 pm
    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.

    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara wrote:
    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara
    Sorry, anyhow looking over this quickly here's a summarization of what
    I see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it is.)

    Now can I see the consumer code?  Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    //    public boolean Exists(String node) throws ParseException,
    IOException{
    //           //        return rdfind.Exists(node);
    //    }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory = FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti: un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node)) commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp, Field.Store.YES,
    Field.Index.NO);
    doc.add(field);                     }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node: "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN = String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);                                 }
    }
    //aggiunta documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA

    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:
    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?


    _*Are you sure the index is the same - what do IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone.  To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Matthew Hall at May 21, 2009 at 1:08 pm
    Its been a few days, and we haven't heard back about this issue, can we
    assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:
    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.

    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara wrote:

    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara
    Sorry, anyhow looking over this quickly here's a summarization of what
    I see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it is.)

    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory = FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti: un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node)) commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp, Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node: "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN = String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA


    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:

    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?



    _*Are you sure the index is the same - what do IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com

    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 21, 2009 at 2:34 pm
    Sorry :( :( :(
    I'm still trying to fix the problem I'll answer in a few hours...

    MARCO LAZZARA
    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:
    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:
    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara
    Sorry, anyhow looking over this quickly here's a summarization of what
    I see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it is.)

    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti: un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN = String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA


    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:

    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?



    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com

    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 21, 2009 at 9:48 pm
    _I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _
    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:
    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:
    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara
    Sorry, anyhow looking over this quickly here's a summarization of what
    I see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it is.)

    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti: un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN = String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA


    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:

    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?



    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com

    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4094 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Ian Lea at May 22, 2009 at 9:10 am
    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.

    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara wrote:
    _I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _
    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:
    Marco


    You haven't answered Matt's question about where you are running it
    from.  Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:
    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara
    Sorry, anyhow looking over this quickly here's a summarization of what
    I see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it is.)

    Now can I see the consumer code?  Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    //    public boolean Exists(String node) throws ParseException,
    IOException{
    //           //        return rdfind.Exists(node);
    //    }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti: un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);                     }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN = String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);                                 }
    }
    //aggiunta documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA


    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:

    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?



    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone.  To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com

    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4094 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 22, 2009 at 2:39 pm
    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>
    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.

    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara wrote:
    _I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _
    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:
    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:
    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like
    /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara
    Sorry, anyhow looking over this quickly here's a summarization of
    what
    I see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering
    all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it
    is.)
    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way
    as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:
    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti:
    un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali
    dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =
    String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta
    documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA


    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from
    your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:

    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.
    New shell?



    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??
    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com

    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4094 (20090521) __________
    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Matthew Hall at May 22, 2009 at 2:50 pm
    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by reference
    to me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying
    to open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire difference
    between an relative path and an absolute one.

    Matt

    Marco Lazzara wrote:
    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>

    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <marco.lazzara@gmail.com>
    wrote:
    _I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _
    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:
    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:

    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like
    /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara

    Sorry, anyhow looking over this quickly here's a summarization of
    what
    I see:

    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering
    all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it
    is.)
    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way
    as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:

    _Could you further post your Analyzer Setup/Query Building code from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti:
    un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali
    dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =
    String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta
    documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA



    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from
    your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your issue.

    Matt

    Ian Lea wrote:


    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.

    New shell?




    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??

    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com

    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4094 (20090521) __________
    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 22, 2009 at 3:44 pm
    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>
    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by reference to
    me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:
    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>


    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <marco.lazzara@gmail.com
    wrote:

    _I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _

    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:

    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:


    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like
    /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).
    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara


    Sorry, anyhow looking over this quickly here's a summarization of
    what
    I see:
    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering
    all
    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it
    is.)
    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way
    as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:


    _Could you further post your Analyzer Setup/Query Building code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti:
    un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali
    dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =
    String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta
    documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA




    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from
    your
    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query Building code
    from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your
    issue.

    Matt

    Ian Lea wrote:



    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.


    New shell?





    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??


    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.


    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org



    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------

    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4094 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Matthew Hall at May 22, 2009 at 4:02 pm
    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt

    Marco Lazzara wrote:
    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>

    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by reference to
    me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:

    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>



    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <marco.lazzara@gmail.com

    wrote:


    _I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _


    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:


    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:



    I've posted the indexing part,but I don't use this in my app.After I
    create the index,I put that in a folder like

    /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).
    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara



    Sorry, anyhow looking over this quickly here's a summarization of

    what
    I see:
    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering

    all
    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path to
    where your index is, you are ASSUMING that its in the same directory
    as this code, unless FSDirectory is not implemented as I think it

    is.)
    Now can I see the consumer code? Specifically the part where you are
    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same way

    as
    you are creating your writer here, I'm pretty darn certain that will
    cause you problems.

    Matt



    Marco Lazzara wrote:



    _Could you further post your Analyzer Setup/Query Building code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new

    RDFinder("RDFIndexLucene/",new
    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti:

    un
    documento per nodo
    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali

    dalle
    sorgenti al nodo
    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y = rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN = String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =

    String.valueOf(0);
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino, Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta

    documento
    all'indice
    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA





    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from

    your
    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query Building code
    from
    both apps.

    Could you further post the document creation code used at indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your
    issue.

    Matt

    Ian Lea wrote:




    ...
    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.



    New shell?






    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??



    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.



    ---------------------------------------------------------------------


    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    ---------------------------------------------------------------------


    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------


    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    __________ Information from ESET NOD32 Antivirus, version of virus

    signature database 4094 (20090521) __________


    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 22, 2009 at 4:10 pm
    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory but with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>
    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:
    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:


    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>




    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:



    _I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _



    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:



    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:




    I've posted the indexing part,but I don't use this in my app.After
    I
    create the index,I put that in a folder like


    /home/marco/RDFIndexLucece
    and when I run the query I'm only searching (and not indexing).

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara




    Sorry, anyhow looking over this quickly here's a summarization of


    what
    I see:

    You have documents in your index that look like the following:
    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering


    all
    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path
    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I think it


    is.)
    Now can I see the consumer code? Specifically the part where you are

    opening the index/constructing your queries?
    I'm betting what's going on here is you are deploying this as a
    war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same
    way


    as
    you are creating your writer here, I'm pretty darn certain that will

    cause you problems.
    Matt



    Marco Lazzara wrote:




    _Could you further post your Analyzer Setup/Query Building code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new


    RDFinder("RDFIndexLucene/",new
    String[] {"name"});

    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti:


    un
    documento per nodo

    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali


    dalle
    sorgenti al nodo

    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =


    String.valueOf(0);
    field = new Field("num_propIn",

    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta


    documento
    all'indice

    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA






    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from


    your
    standalone app, as well as your webapp.

    Could you further post your Analyzer Setup/Query Building code
    from
    both apps.

    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your
    issue.

    Matt

    Ian Lea wrote:





    ...

    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.




    New shell?







    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??




    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.




    ---------------------------------------------------------------------



    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org

    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    ---------------------------------------------------------------------



    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org

    For additional commands, e-mail: java-user-help@lucene.apache.org



    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com






    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com






    ---------------------------------------------------------------------



    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org

    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    __________ Information from ESET NOD32 Antivirus, version of virus


    signature database 4094 (20090521) __________



    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Matthew Hall at May 22, 2009 at 4:40 pm
    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever
    the heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile
    and create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And the
    indexes you are creating exist at EXACTLY the place you have asked them to.

    Step 3: Then.. go download luke, and open these indexes. Perform a
    query on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever
    you are using in the to open the index with the SAME string I have
    listed above.

    Perform a search, verify that the indexes are there, and actually return
    values.

    Step 5: Lastly, go into your web application and again replace the path
    with the one I have above, recompile, and perform a search. Verify that
    the indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to
    some other issues in what you have setup. For example your tomcat
    instance could perhaps not have permission to read the lucene indexes
    directory. You should be able to tell this in the tomcat logs, BUT
    don't do this yet. Carefully and fully follow the steps I have outlined
    for you, and then you have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at
    your source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.

    Matt



    Marco Lazzara wrote:
    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory but with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>

    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:

    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:



    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>





    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:




    _I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _




    Its been a few days, and we haven't heard back about this issue, can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:




    Marco


    You haven't answered Matt's question about where you are running it
    from. Tomcat's default directory may well not be the same as yours.
    I strongly suggest that you use a full path name and/or provide some
    evidence that your readers and writers are using the same directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:





    I've posted the indexing part,but I don't use this in my app.After
    I
    create the index,I put that in a folder like



    /home/marco/RDFIndexLucece

    and when I run the query I'm only searching (and not indexing).


    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara





    Sorry, anyhow looking over this quickly here's a summarization of



    what

    I see:


    You have documents in your index that look like the following:
    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which considering



    all

    the Italian? is an interesting choice.)


    And you are opening your index using FSDirectory, in what appears to
    be a by reference fashion (You don't have a fully qualified path
    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I think it



    is.)

    Now can I see the consumer code? Specifically the part where you are


    opening the index/constructing your queries?
    I'm betting what's going on here is you are deploying this as a
    war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it from?
    Cause if you are opening your index reader/searcher in the same
    way



    as

    you are creating your writer here, I'm pretty darn certain that will


    cause you problems.
    Matt



    Marco Lazzara wrote:





    _Could you further post your Analyzer Setup/Query Building code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new



    RDFinder("RDFIndexLucene/",new

    String[] {"name"});


    // public boolean Exists(String node) throws ParseException,
    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti:



    un

    documento per nodo


    for (int i = 0; i < nodesize; i++){
    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali



    dalle

    sorgenti al nodo


    // non indicizzati
    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is < propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =



    String.valueOf(0);

    field = new Field("num_propIn",


    num_propIN,
    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta



    documento

    all'indice


    iwriter.addDocument(doc);
    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA







    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code from



    your

    standalone app, as well as your webapp.


    Could you further post your Analyzer Setup/Query Building code
    from
    both apps.

    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your
    issue.

    Matt

    Ian Lea wrote:






    ...


    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.





    New shell?








    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??





    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm you're
    looking at the same index, and it has documents, etc.


    --
    Ian.





    ---------------------------------------------------------------------




    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org


    For additional commands, e-mail:
    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------




    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org


    For additional commands, e-mail: java-user-help@lucene.apache.org

    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com







    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com







    ---------------------------------------------------------------------




    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org


    For additional commands, e-mail: java-user-help@lucene.apache.org



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com






    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    __________ Information from ESET NOD32 Antivirus, version of virus



    signature database 4094 (20090521) __________




    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 22, 2009 at 5:24 pm
    Thanks a lot.But now I'am going to work(waiter).When I come back I'll
    immediately do that

    Thanks again.You are so kind.


    2009/5/22 Matthew Hall <mhall@informatics.jax.org>
    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And the
    indexes you are creating exist at EXACTLY the place you have asked them to.

    Step 3: Then.. go download luke, and open these indexes. Perform a query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever you
    are using in the to open the index with the SAME string I have listed above.

    Perform a search, verify that the indexes are there, and actually return
    values.

    Step 5: Lastly, go into your web application and again replace the path
    with the one I have above, recompile, and perform a search. Verify that the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to some
    other issues in what you have setup. For example your tomcat instance could
    perhaps not have permission to read the lucene indexes directory. You
    should be able to tell this in the tomcat logs, BUT don't do this yet.
    Carefully and fully follow the steps I have outlined for you, and then you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.


    Matt



    Marco Lazzara wrote:
    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:


    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:




    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>






    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:





    _I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _





    Its been a few days, and we haven't heard back about this issue,
    can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:





    Marco


    You haven't answered Matt's question about where you are running
    it
    from. Tomcat's default directory may well not be the same as
    yours.
    I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:






    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like




    /home/marco/RDFIndexLucece


    and when I run the query I'm only searching (and not indexing).


    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};

    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara






    Sorry, anyhow looking over this quickly here's a summarization
    of




    what


    I see:


    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering




    all


    the Italian? is an interesting choice.)


    And you are opening your index using FSDirectory, in what appears
    to

    be a by reference fashion (You don't have a fully qualified path
    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I think
    it




    is.)


    Now can I see the consumer code? Specifically the part where you
    are



    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a
    war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it
    from?
    Cause if you are opening your index reader/searcher in the same
    way




    as


    you are creating your writer here, I'm pretty darn certain that
    will



    cause you problems.

    Matt


    Marco Lazzara wrote:






    _Could you further post your Analyzer Setup/Query Building code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new




    RDFinder("RDFIndexLucene/",new


    String[] {"name"});


    // public boolean Exists(String node) throws ParseException,

    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti:




    un


    documento per nodo


    for (int i = 0; i < nodesize; i++){

    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali




    dalle


    sorgenti al nodo


    // non indicizzati

    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =




    String.valueOf(0);


    field = new Field("num_propIn",


    num_propIN,

    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta




    documento


    all'indice


    iwriter.addDocument(doc);

    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA








    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code
    from




    your


    standalone app, as well as your webapp.


    Could you further post your Analyzer Setup/Query Building code

    from
    both apps.

    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your
    issue.

    Matt

    Ian Lea wrote:







    ...



    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.






    New shell?









    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??






    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.






    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail:

    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail: java-user-help@lucene.apache.org

    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com







    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com






    __________ Information from ESET NOD32 Antivirus, version of virus




    signature database 4094 (20090521) __________





    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 24, 2009 at 9:25 am
    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at
    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at org.apache.lucene.search.IndexSearcher.(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>
    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And the
    indexes you are creating exist at EXACTLY the place you have asked them to.

    Step 3: Then.. go download luke, and open these indexes. Perform a query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever you
    are using in the to open the index with the SAME string I have listed above.

    Perform a search, verify that the indexes are there, and actually return
    values.

    Step 5: Lastly, go into your web application and again replace the path
    with the one I have above, recompile, and perform a search. Verify that the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to some
    other issues in what you have setup. For example your tomcat instance could
    perhaps not have permission to read the lucene indexes directory. You
    should be able to tell this in the tomcat logs, BUT don't do this yet.
    Carefully and fully follow the steps I have outlined for you, and then you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.


    Matt



    Marco Lazzara wrote:
    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:


    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:




    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>






    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:





    _I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _





    Its been a few days, and we haven't heard back about this issue,
    can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:





    Marco


    You haven't answered Matt's question about where you are running
    it
    from. Tomcat's default directory may well not be the same as
    yours.
    I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:






    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like




    /home/marco/RDFIndexLucece


    and when I run the query I'm only searching (and not indexing).


    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};

    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara






    Sorry, anyhow looking over this quickly here's a summarization
    of




    what


    I see:


    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering




    all


    the Italian? is an interesting choice.)


    And you are opening your index using FSDirectory, in what appears
    to

    be a by reference fashion (You don't have a fully qualified path
    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I think
    it




    is.)


    Now can I see the consumer code? Specifically the part where you
    are



    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a
    war
    file into tomcat, and its just not really finding the index as a
    result of how the war file is getting deployed, but looking more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it
    from?
    Cause if you are opening your index reader/searcher in the same
    way




    as


    you are creating your writer here, I'm pretty darn certain that
    will



    cause you problems.

    Matt


    Marco Lazzara wrote:






    _Could you further post your Analyzer Setup/Query Building code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new




    RDFinder("RDFIndexLucene/",new


    String[] {"name"});


    // public boolean Exists(String node) throws ParseException,

    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist = rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n documenti:




    un


    documento per nodo


    for (int i = 0; i < nodesize; i++){

    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali




    dalle


    sorgenti al nodo


    // non indicizzati

    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null", Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn", num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =




    String.valueOf(0);


    field = new Field("num_propIn",


    num_propIN,

    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta




    documento


    all'indice


    iwriter.addDocument(doc);

    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA








    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code
    from




    your


    standalone app, as well as your webapp.


    Could you further post your Analyzer Setup/Query Building code

    from
    both apps.

    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your
    issue.

    Matt

    Ian Lea wrote:







    ...



    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.






    New shell?









    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??






    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.






    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail:

    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail: java-user-help@lucene.apache.org

    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com







    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com






    __________ Information from ESET NOD32 Antivirus, version of virus




    signature database 4094 (20090521) __________





    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 24, 2009 at 10:06 am
    Ok i solve the problem I've posted before,I run the web app..It creates the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>
    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at
    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>
    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And the
    indexes you are creating exist at EXACTLY the place you have asked them to.

    Step 3: Then.. go download luke, and open these indexes. Perform a query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever you
    are using in the to open the index with the SAME string I have listed above.

    Perform a search, verify that the indexes are there, and actually return
    values.

    Step 5: Lastly, go into your web application and again replace the path
    with the one I have above, recompile, and perform a search. Verify that the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to some
    other issues in what you have setup. For example your tomcat instance could
    perhaps not have permission to read the lucene indexes directory. You
    should be able to tell this in the tomcat logs, BUT don't do this yet.
    Carefully and fully follow the steps I have outlined for you, and then you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.


    Matt



    Marco Lazzara wrote:
    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:


    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:




    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>






    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:





    _I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _





    Its been a few days, and we haven't heard back about this issue,
    can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:





    Marco


    You haven't answered Matt's question about where you are running
    it
    from. Tomcat's default directory may well not be the same as
    yours.
    I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:






    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like




    /home/marco/RDFIndexLucece


    and when I run the query I'm only searching (and not indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};

    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara






    Sorry, anyhow looking over this quickly here's a summarization
    of




    what


    I see:


    You have documents in your index that look like the following:

    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering




    all


    the Italian? is an interesting choice.)


    And you are opening your index using FSDirectory, in what appears
    to

    be a by reference fashion (You don't have a fully qualified path
    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I think
    it




    is.)


    Now can I see the consumer code? Specifically the part where you
    are



    opening the index/constructing your queries?

    I'm betting what's going on here is you are deploying this as a
    war
    file into tomcat, and its just not really finding the index as
    a
    result of how the war file is getting deployed, but looking
    more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it
    from?
    Cause if you are opening your index reader/searcher in the same
    way




    as


    you are creating your writer here, I'm pretty darn certain that
    will



    cause you problems.

    Matt


    Marco Lazzara wrote:






    _Could you further post your Analyzer Setup/Query Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new




    RDFinder("RDFIndexLucene/",new


    String[] {"name"});


    // public boolean Exists(String node) throws ParseException,

    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:




    un


    documento per nodo


    for (int i = 0; i < nodesize; i++){

    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali




    dalle


    sorgenti al nodo


    // non indicizzati

    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di
    proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =




    String.valueOf(0);


    field = new Field("num_propIn",


    num_propIN,

    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta




    documento


    all'indice


    iwriter.addDocument(doc);

    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA








    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code
    from




    your


    standalone app, as well as your webapp.


    Could you further post your Analyzer Setup/Query Building code

    from
    both apps.

    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your
    issue.

    Matt

    Ian Lea wrote:







    ...



    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.






    New shell?









    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??






    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.






    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail:

    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail: java-user-help@lucene.apache.org

    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    ---------------------------------------------------------------------





    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org



    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com







    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com






    __________ Information from ESET NOD32 Antivirus, version of virus




    signature database 4094 (20090521) __________





    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Matthew Hall at May 26, 2009 at 12:58 pm
    Right.. so perhaps I'm a bit confused here.

    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you were
    using to first build your indexes, which the webapp then consumes.

    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over here.



    Marco Lazzara wrote:
    Ok i solve the problem I've posted before,I run the web app..It creates the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>

    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at
    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>

    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And the
    indexes you are creating exist at EXACTLY the place you have asked them to.

    Step 3: Then.. go download luke, and open these indexes. Perform a query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever you
    are using in the to open the index with the SAME string I have listed above.

    Perform a search, verify that the indexes are there, and actually return
    values.

    Step 5: Lastly, go into your web application and again replace the path
    with the one I have above, recompile, and perform a search. Verify that the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to some
    other issues in what you have setup. For example your tomcat instance could
    perhaps not have permission to read the lucene indexes directory. You
    should be able to tell this in the tomcat logs, BUT don't do this yet.
    Carefully and fully follow the steps I have outlined for you, and then you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.


    Matt



    Marco Lazzara wrote:

    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:



    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>





    For writing indexes?

    Well I guess it depends on what you want.. but I personally use this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:





    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>







    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know you've
    already posted some code, but maybe not all of it, and definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:






    _I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _






    Its been a few days, and we haven't heard back about this issue,
    can
    we assume that you fixed it via using fully qualified paths then?

    Matt

    Ian Lea wrote:






    Marco


    You haven't answered Matt's question about where you are running
    it
    from. Tomcat's default directory may well not be the same as
    yours.
    I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:







    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like





    /home/marco/RDFIndexLucece



    and when I run the query I'm only searching (and not indexing).
    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};


    //RDFinder rdfind = new RDFinder("RDFIndexLucene/",fieldsearch);
    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara







    Sorry, anyhow looking over this quickly here's a summarization
    of





    what



    I see:
    You have documents in your index that look like the following:


    name which is indexed and stored.
    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering





    all



    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in what appears
    to


    be a by reference fashion (You don't have a fully qualified path
    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I think
    it





    is.)



    Now can I see the consumer code? Specifically the part where you
    are




    opening the index/constructing your queries?


    I'm betting what's going on here is you are deploying this as a
    war
    file into tomcat, and its just not really finding the index as
    a
    result of how the war file is getting deployed, but looking
    more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it
    from?
    Cause if you are opening your index reader/searcher in the same
    way





    as



    you are creating your writer here, I'm pretty darn certain that
    will




    cause you problems.


    Matt
    Marco Lazzara wrote:







    _Could you further post your Analyzer Setup/Query Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new





    RDFinder("RDFIndexLucene/",new



    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,


    IOException{
    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename) throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:





    un



    documento per nodo
    for (int i = 0; i < nodesize; i++){


    Document doc = new Document();
    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali





    dalle



    sorgenti al nodo
    // non indicizzati


    for (int j = 0; j < sourcesize; j++) {
    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di
    proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =





    String.valueOf(0);



    field = new Field("num_propIn",
    num_propIN,


    Field.Store.YES, Field.Index.NO);
    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field); }
    }
    //aggiunta





    documento



    all'indice
    iwriter.addDocument(doc);


    }
    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA









    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code
    from





    your



    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query Building code


    from
    both apps.

    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down your
    issue.

    Matt

    Ian Lea wrote:








    ...




    There are no exceptions.When I run the query a new shell is
    displayed but
    with no result.







    New shell?










    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??







    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.







    ---------------------------------------------------------------------






    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:


    java-user-help@lucene.apache.org





    ---------------------------------------------------------------------






    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail: java-user-help@lucene.apache.org


    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com









    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com









    ---------------------------------------------------------------------






    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail: java-user-help@lucene.apache.org




    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com







    __________ Information from ESET NOD32 Antivirus, version of virus





    signature database 4094 (20090521) __________






    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org





    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 26, 2009 at 8:46 pm
    I tried different things.I tried to create the index without the web
    application,I tried to create the index with a webapp and the index was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp cathces an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it fails..maybe the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>
    Right.. so perhaps I'm a bit confused here.

    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you were
    using to first build your indexes, which the webapp then consumes.

    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over here.




    Marco Lazzara wrote:
    Ok i solve the problem I've posted before,I run the web app..It creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>


    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at

    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at

    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at

    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at

    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And the
    indexes you are creating exist at EXACTLY the place you have asked them
    to.

    Step 3: Then.. go download luke, and open these indexes. Perform a
    query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever
    you
    are using in the to open the index with the SAME string I have listed
    above.

    Perform a search, verify that the indexes are there, and actually return
    values.

    Step 5: Lastly, go into your web application and again replace the path
    with the one I have above, recompile, and perform a search. Verify that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to
    some
    other issues in what you have setup. For example your tomcat instance
    could
    perhaps not have permission to read the lucene indexes directory. You
    should be able to tell this in the tomcat logs, BUT don't do this yet.
    Carefully and fully follow the steps I have outlined for you, and then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.


    Matt



    Marco Lazzara wrote:


    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:




    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>






    For writing indexes?

    Well I guess it depends on what you want.. but I personally use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by
    that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:






    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>








    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know
    you've
    already posted some code, but maybe not all of it, and definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:







    _I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _







    Its been a few days, and we haven't heard back about this issue,
    can
    we assume that you fixed it via using fully qualified paths
    then?

    Matt

    Ian Lea wrote:







    Marco


    You haven't answered Matt's question about where you are
    running
    it
    from. Tomcat's default directory may well not be the same as
    yours.
    I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:








    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like






    /home/marco/RDFIndexLucece




    and when I run the query I'm only searching (and not indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};



    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);

    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara








    Sorry, anyhow looking over this quickly here's a
    summarization
    of






    what




    I see:
    You have documents in your index that look like the following:



    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering






    all




    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in what
    appears
    to



    be a by reference fashion (You don't have a fully qualified
    path

    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I
    think
    it






    is.)




    Now can I see the consumer code? Specifically the part where
    you
    are




    opening the index/constructing your queries?



    I'm betting what's going on here is you are deploying this as
    a

    war
    file into tomcat, and its just not really finding the index
    as
    a
    result of how the war file is getting deployed, but looking
    more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it
    from?
    Cause if you are opening your index reader/searcher in the
    same
    way






    as




    you are creating your writer here, I'm pretty darn certain that
    will




    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new






    RDFinder("RDFIndexLucene/",new




    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,



    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:






    un




    documento per nodo
    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali






    dalle




    sorgenti al nodo
    // non indicizzati



    for (int j = 0; j < sourcesize; j++) {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di
    proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =






    String.valueOf(0);




    field = new Field("num_propIn",
    num_propIN,



    Field.Store.YES, Field.Index.NO);

    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    }
    }
    //aggiunta






    documento




    all'indice
    iwriter.addDocument(doc);



    }

    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA










    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code
    from






    your




    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query Building code



    from

    both apps.
    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down
    your
    issue.

    Matt

    Ian Lea wrote:









    ...





    There are no exceptions.When I run the query a new shell
    is
    displayed but
    with no result.








    New shell?











    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??








    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.








    ---------------------------------------------------------------------







    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org





    For additional commands, e-mail:



    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------







    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org





    For additional commands, e-mail:
    java-user-help@lucene.apache.org



    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    ---------------------------------------------------------------------







    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org





    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com









    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com






    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org









    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus






    signature database 4094 (20090521) __________







    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • N Hira at May 26, 2009 at 9:00 pm
    Marco,

    Does the part of the web app that is responsible for searching have permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the directory listing to confirm?

    Also, I may have missed this posting, but could you provide the answer from Step 3. of mhall's suggestion on 22-May, i.e., did you find the data that you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the web
    application,I tried to create the index with a webapp and the index was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp cathces an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it fails..maybe the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>
    Right.. so perhaps I'm a bit confused here.

    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you were
    using to first build your indexes, which the webapp then consumes.

    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over here.




    Marco Lazzara wrote:
    Ok i solve the problem I've posted before,I run the web app..It creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>


    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at

    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at

    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at

    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at

    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And the
    indexes you are creating exist at EXACTLY the place you have asked them
    to.

    Step 3: Then.. go download luke, and open these indexes. Perform a
    query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever
    you
    are using in the to open the index with the SAME string I have listed
    above.

    Perform a search, verify that the indexes are there, and actually return
    values.

    Step 5: Lastly, go into your web application and again replace the path
    with the one I have above, recompile, and perform a search. Verify that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to
    some
    other issues in what you have setup. For example your tomcat instance
    could
    perhaps not have permission to read the lucene indexes directory. You
    should be able to tell this in the tomcat logs, BUT don't do this yet.
    Carefully and fully follow the steps I have outlined for you, and then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.


    Matt



    Marco Lazzara wrote:


    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:




    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>






    For writing indexes?

    Well I guess it depends on what you want.. but I personally use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by
    that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:






    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>








    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know
    you've
    already posted some code, but maybe not all of it, and definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:







    _I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.

    MARCOLAZZARA
    _

    _







    Its been a few days, and we haven't heard back about this issue,
    can
    we assume that you fixed it via using fully qualified paths
    then?

    Matt

    Ian Lea wrote:







    Marco


    You haven't answered Matt's question about where you are
    running
    it
    from. Tomcat's default directory may well not be the same as
    yours.
    I strongly suggest that you use a full path name and/or provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:








    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like






    /home/marco/RDFIndexLucece




    and when I run the query I'm only searching (and not indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};



    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);

    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara








    Sorry, anyhow looking over this quickly here's a
    summarization
    of






    what




    I see:
    You have documents in your index that look like the following:



    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering






    all




    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in what
    appears
    to



    be a by reference fashion (You don't have a fully qualified
    path

    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I
    think
    it






    is.)




    Now can I see the consumer code? Specifically the part where
    you
    are




    opening the index/constructing your queries?



    I'm betting what's going on here is you are deploying this as
    a

    war
    file into tomcat, and its just not really finding the index
    as
    a
    result of how the war file is getting deployed, but looking
    more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it
    from?
    Cause if you are opening your index reader/searcher in the
    same
    way






    as




    you are creating your writer here, I'm pretty darn certain that
    will




    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new






    RDFinder("RDFIndexLucene/",new




    String[] {"name"});
    // public boolean Exists(String node) throws ParseException,



    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura dell'indice
    //Tale istanza viene fornita di analyzer, di un boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true, new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:






    un




    documento per nodo
    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali






    dalle




    sorgenti al nodo
    // non indicizzati



    for (int j = 0; j < sourcesize; j++) {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di
    proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =






    String.valueOf(0);




    field = new Field("num_propIn",
    num_propIN,



    Field.Store.YES, Field.Index.NO);

    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v = rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    }
    }
    //aggiunta






    documento




    all'indice
    iwriter.addDocument(doc);



    }

    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA










    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization code
    from






    your




    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query Building code



    from

    both apps.
    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are indexed/stored)

    Give us this, and I'm pretty darn sure we can nail down
    your
    issue.

    Matt

    Ian Lea wrote:









    ...





    There are no exceptions.When I run the query a new shell
    is
    displayed but
    with no result.








    New shell?











    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??








    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.








    ---------------------------------------------------------------------







    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org





    For additional commands, e-mail:



    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------







    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org





    For additional commands, e-mail:
    java-user-help@lucene.apache.org



    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    ---------------------------------------------------------------------







    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org





    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com









    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com






    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org









    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus






    signature database 4094 (20090521) __________







    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 26, 2009 at 9:59 pm
    *Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the answer from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>
    Marco,

    Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the answer from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the web
    application,I tried to create the index with a webapp and the index was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp cathces an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it fails..maybe the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>
    Right.. so perhaps I'm a bit confused here.

    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you were
    using to first build your indexes, which the webapp then consumes.

    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over here.



    Marco Lazzara wrote:
    Ok i solve the problem I've posted before,I run the web app..It creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>


    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in
    the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at
    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And
    the
    indexes you are creating exist at EXACTLY the place you have asked
    them
    to.

    Step 3: Then.. go download luke, and open these indexes. Perform a
    query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever
    you
    are using in the to open the index with the SAME string I have listed
    above.

    Perform a search, verify that the indexes are there, and actually
    return
    values.

    Step 5: Lastly, go into your web application and again replace the
    path
    with the one I have above, recompile, and perform a search. Verify
    that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to
    some
    other issues in what you have setup. For example your tomcat instance
    could
    perhaps not have permission to read the lucene indexes directory. You
    should be able to tell this in the tomcat logs, BUT don't do this yet.
    Carefully and fully follow the steps I have outlined for you, and
    then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really
    helpful.

    Matt



    Marco Lazzara wrote:


    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory
    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:




    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in
    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>






    For writing indexes?

    Well I guess it depends on what you want.. but I personally use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by
    that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:






    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at
    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>








    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:







    _I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is
    changed.
    MARCOLAZZARA
    _

    _







    Its been a few days, and we haven't heard back about this
    issue,
    can
    we assume that you fixed it via using fully qualified paths
    then?

    Matt

    Ian Lea wrote:







    Marco


    You haven't answered Matt's question about where you are
    running
    it
    from. Tomcat's default directory may well not be the same as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:








    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like






    /home/marco/RDFIndexLucece




    and when I run the query I'm only searching (and not
    indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};



    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);

    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara








    Sorry, anyhow looking over this quickly here's a
    summarization
    of






    what




    I see:
    You have documents in your index that look like the following:



    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering






    all




    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in what
    appears
    to



    be a by reference fashion (You don't have a fully qualified
    path

    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I
    think
    it






    is.)




    Now can I see the consumer code? Specifically the part where
    you
    are




    opening the index/constructing your queries?



    I'm betting what's going on here is you are deploying this
    as
    a

    war
    file into tomcat, and its just not really finding the index
    as
    a
    result of how the war file is getting deployed, but looking
    more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it
    from?
    Cause if you are opening your index reader/searcher in the
    same
    way






    as




    you are creating your writer here, I'm pretty darn certain
    that
    will




    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new






    RDFinder("RDFIndexLucene/",new




    String[] {"name"});
    // public boolean Exists(String node) throws
    ParseException,


    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare
    analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura
    dell'indice
    //Tale istanza viene fornita di analyzer, di un
    boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true,
    new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:






    un




    documento per nodo
    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path
    minimali





    dalle




    sorgenti al nodo
    // non indicizzati



    for (int j = 0; j < sourcesize; j++) {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di
    proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =






    String.valueOf(0);




    field = new Field("num_propIn",
    num_propIN,



    Field.Store.YES, Field.Index.NO);

    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v =
    rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    }
    }
    //aggiunta






    documento




    all'indice
    iwriter.addDocument(doc);



    }

    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA










    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization
    code
    from






    your




    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query Building code



    from

    both apps.
    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are
    indexed/stored)
    Give us this, and I'm pretty darn sure we can nail down
    your
    issue.

    Matt

    Ian Lea wrote:









    ...





    There are no exceptions.When I run the query a new
    shell
    is
    displayed but
    with no result.








    New shell?











    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??








    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.








    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:



    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:
    java-user-help@lucene.apache.org



    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    __________ Information from ESET NOD32 Antivirus, version
    of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version
    of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com









    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org









    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus






    signature database 4094 (20090521) __________







    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • N Hira at May 26, 2009 at 10:47 pm
    Sorry for the confusion -- I checked the archive and I could not find a message where you have been able to open the index using Luke.

    Have you been able to do that? I see that you have reported the creation of 3 files, but does Luke recognize those files as an index and do you see the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the answer from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>
    Marco,

    Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the answer from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the web
    application,I tried to create the index with a webapp and the index was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp cathces an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it fails..maybe the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>
    Right.. so perhaps I'm a bit confused here.

    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you were
    using to first build your indexes, which the webapp then consumes.

    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over here.



    Marco Lazzara wrote:
    Ok i solve the problem I've posted before,I run the web app..It creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>


    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in
    the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at
    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software, recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And
    the
    indexes you are creating exist at EXACTLY the place you have asked
    them
    to.

    Step 3: Then.. go download luke, and open these indexes. Perform a
    query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace whatever
    you
    are using in the to open the index with the SAME string I have listed
    above.

    Perform a search, verify that the indexes are there, and actually
    return
    values.

    Step 5: Lastly, go into your web application and again replace the
    path
    with the one I have above, recompile, and perform a search. Verify
    that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to
    some
    other issues in what you have setup. For example your tomcat instance
    could
    perhaps not have permission to read the lucene indexes directory. You
    should be able to tell this in the tomcat logs, BUT don't do this yet.
    Carefully and fully follow the steps I have outlined for you, and
    then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really
    helpful.

    Matt



    Marco Lazzara wrote:


    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory
    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:




    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in
    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>






    For writing indexes?

    Well I guess it depends on what you want.. but I personally use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.

    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by
    that,

    Lets say you are running your program in the following directory:

    /home/test/app/

    Trying to open an index like you have below will effectively be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:






    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at
    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>








    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:







    _I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is
    changed.
    MARCOLAZZARA
    _

    _







    Its been a few days, and we haven't heard back about this
    issue,
    can
    we assume that you fixed it via using fully qualified paths
    then?

    Matt

    Ian Lea wrote:







    Marco


    You haven't answered Matt's question about where you are
    running
    it
    from. Tomcat's default directory may well not be the same as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:








    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like






    /home/marco/RDFIndexLucece




    and when I run the query I'm only searching (and not
    indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};



    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);

    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara








    Sorry, anyhow looking over this quickly here's a
    summarization
    of






    what




    I see:
    You have documents in your index that look like the following:



    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering






    all




    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in what
    appears
    to



    be a by reference fashion (You don't have a fully qualified
    path

    to
    where your index is, you are ASSUMING that its in the same
    directory
    as this code, unless FSDirectory is not implemented as I
    think
    it






    is.)




    Now can I see the consumer code? Specifically the part where
    you
    are




    opening the index/constructing your queries?



    I'm betting what's going on here is you are deploying this
    as
    a

    war
    file into tomcat, and its just not really finding the index
    as
    a
    result of how the war file is getting deployed, but looking
    more
    closely at the source code should reveal if my suspicion is
    correct
    here.

    Also runtime wise, when you run your standalone app, where
    specifically in your directory structure are you running it
    from?
    Cause if you are opening your index reader/searcher in the
    same
    way






    as




    you are creating your writer here, I'm pretty darn certain
    that
    will




    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new






    RDFinder("RDFIndexLucene/",new




    String[] {"name"});
    // public boolean Exists(String node) throws
    ParseException,


    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare
    analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura
    dell'indice
    //Tale istanza viene fornita di analyzer, di un
    boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true,
    new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:






    un




    documento per nodo
    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node)) break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++) {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path
    minimali





    dalle




    sorgenti al nodo
    // non indicizzati



    for (int j = 0; j < sourcesize; j++) {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++) {
    String pp = rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field); }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ " node:
    "+node);
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms = wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di
    proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =






    String.valueOf(0);




    field = new Field("num_propIn",
    num_propIN,



    Field.Store.YES, Field.Index.NO);

    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v =
    rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    }
    }
    //aggiunta






    documento




    all'indice
    iwriter.addDocument(doc);



    }

    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA










    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization
    code
    from






    your




    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query Building code



    from

    both apps.
    Could you further post the document creation code used at
    indexing
    time? (Which analyzer, and which fields are
    indexed/stored)
    Give us this, and I'm pretty darn sure we can nail down
    your
    issue.

    Matt

    Ian Lea wrote:









    ...





    There are no exceptions.When I run the query a new
    shell
    is
    displayed but
    with no result.








    New shell?











    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??








    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.








    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:



    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:
    java-user-help@lucene.apache.org



    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    __________ Information from ESET NOD32 Antivirus, version
    of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version
    of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com









    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org









    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus






    signature database 4094 (20090521) __________







    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org






    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 27, 2009 at 7:03 am
    * I see that you have reported the creation of 3 files, but does Luke
    recognize those files as an index and do you see the Documents you expect to
    see in this index?*
    Luke recognizes those files and I see those documents in this index but I
    observed that when I run the query Luke finds (for example) only 3 files of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>
    Sorry for the confusion -- I checked the archive and I could not find a
    message where you have been able to open the index using Luke.

    Have you been able to do that? I see that you have reported the creation
    of 3 files, but does Luke recognize those files as an index and do you see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>
    Marco,

    Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the answer from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the web
    application,I tried to create the index with a webapp and the index was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp cathces an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it fails..maybe the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>
    Right.. so perhaps I'm a bit confused here.

    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you
    were
    using to first build your indexes, which the webapp then consumes.

    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over here.



    Marco Lazzara wrote:
    Ok i solve the problem I've posted before,I run the web app..It
    creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>


    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in
    the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at
    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace
    whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software,
    recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And
    the
    indexes you are creating exist at EXACTLY the place you have asked
    them
    to.

    Step 3: Then.. go download luke, and open these indexes. Perform a
    query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace
    whatever
    you
    are using in the to open the index with the SAME string I have
    listed
    above.

    Perform a search, verify that the indexes are there, and actually
    return
    values.

    Step 5: Lastly, go into your web application and again replace the
    path
    with the one I have above, recompile, and perform a search. Verify
    that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to
    some
    other issues in what you have setup. For example your tomcat
    instance
    could
    perhaps not have permission to read the lucene indexes directory.
    You
    should be able to tell this in the tomcat logs, BUT don't do this
    yet.
    Carefully and fully follow the steps I have outlined for you, and
    then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look
    at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really
    helpful.

    Matt



    Marco Lazzara wrote:


    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory
    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:




    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in
    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>






    For writing indexes?

    Well I guess it depends on what you want.. but I personally use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue
    here.
    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by
    that,

    Lets say you are running your program in the following
    directory:
    /home/test/app/

    Trying to open an index like you have below will effectively be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:






    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at
    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>








    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:







    _I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is
    changed.
    MARCOLAZZARA
    _

    _







    Its been a few days, and we haven't heard back about this
    issue,
    can
    we assume that you fixed it via using fully qualified paths
    then?

    Matt

    Ian Lea wrote:







    Marco


    You haven't answered Matt's question about where you are
    running
    it
    from. Tomcat's default directory may well not be the same
    as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:








    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like






    /home/marco/RDFIndexLucece




    and when I run the query I'm only searching (and not
    indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};



    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);

    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara








    Sorry, anyhow looking over this quickly here's a
    summarization
    of






    what




    I see:
    You have documents in your index that look like the
    following:


    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering






    all




    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in what
    appears
    to



    be a by reference fashion (You don't have a fully
    qualified
    path

    to
    where your index is, you are ASSUMING that its in the
    same
    directory
    as this code, unless FSDirectory is not implemented as I
    think
    it






    is.)




    Now can I see the consumer code? Specifically the part
    where
    you
    are




    opening the index/constructing your queries?



    I'm betting what's going on here is you are deploying this
    as
    a

    war
    file into tomcat, and its just not really finding the
    index
    as
    a
    result of how the war file is getting deployed, but
    looking
    more
    closely at the source code should reveal if my suspicion
    is
    correct
    here.

    Also runtime wise, when you run your standalone app,
    where
    specifically in your directory structure are you running
    it
    from?
    Cause if you are opening your index reader/searcher in
    the
    same
    way






    as




    you are creating your writer here, I'm pretty darn certain
    that
    will




    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query
    Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new






    RDFinder("RDFIndexLucene/",new




    String[] {"name"});
    // public boolean Exists(String node) throws
    ParseException,


    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare
    analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura
    dell'indice
    //Tale istanza viene fornita di analyzer, di un
    boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o
    infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true,
    new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:






    un




    documento per nodo
    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node))
    break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++)
    {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path
    minimali





    dalle




    sorgenti al nodo
    // non indicizzati



    for (int j = 0; j < sourcesize; j++) {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++)
    {
    String pp =
    rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ "
    node:
    "+node);
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms =
    wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di
    proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =






    String.valueOf(0);




    field = new Field("num_propIn",
    num_propIN,



    Field.Store.YES, Field.Index.NO);

    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v =
    rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    }
    }
    //aggiunta






    documento




    all'indice
    iwriter.addDocument(doc);



    }

    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA










    Things that could help us immensely here.

    Can you post your indexReader/Searcher initialization
    code
    from






    your




    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query Building
    code


    from

    both apps.
    Could you further post the document creation code used
    at
    indexing
    time? (Which analyzer, and which fields are
    indexed/stored)
    Give us this, and I'm pretty darn sure we can nail down
    your
    issue.

    Matt

    Ian Lea wrote:









    ...





    There are no exceptions.When I run the query a new
    shell
    is
    displayed but
    with no result.








    New shell?











    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??








    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc(), ...);

    and run in tomcat and standalone. To absolutely
    confirm
    you're
    looking at the same index, and it has documents, etc.


    --
    Ian.








    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:



    java-user-help@lucene.apache.org






    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:
    java-user-help@lucene.apache.org



    __________ Information from ESET NOD32 Antivirus, version
    of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    __________ Information from ESET NOD32 Antivirus,
    version
    of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    ---------------------------------------------------------------------






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version
    of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com









    __________ Information from ESET NOD32 Antivirus, version
    of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org









    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus, version of
    virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus, version of
    virus






    signature database 4094 (20090521) __________







    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • N. Hira at May 27, 2009 at 2:40 pm
    Not sure if this applies here, but that tends to happen when the
    analyzer you use for indexing is different from the one used in Luke
    or you're running into character set issues. Are you using the
    StandardAnalyzer in both cases?

    Also, could you post an example of the query you are trying? There
    are some very smart people who check this list and they may be able
    to help you if they had a "sample" of your index, i.e., create a 10-
    document index and make it available for download so people can look
    at it for you?

    -h
    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but does Luke
    recognize those files as an index and do you see the Documents you
    expect to
    see in this index?*
    Luke recognizes those files and I see those documents in this index
    but I
    observed that when I run the query Luke finds (for example) only 3
    files of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>
    Sorry for the confusion -- I checked the archive and I could not
    find a
    message where you have been able to open the index using Luke.

    Have you been able to do that? I see that you have reported the
    creation
    of 3 files, but does Luke recognize those files as an index and do
    you see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the
    directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the
    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the
    data that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>
    Marco,

    Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the
    directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the
    answer from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the
    data that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the
    web
    application,I tried to create the index with a webapp and the
    index was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp
    cathces an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it
    fails..maybe the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>
    Right.. so perhaps I'm a bit confused here.

    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you
    were
    using to first build your indexes, which the webapp then consumes.

    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday
    over here.



    Marco Lazzara wrote:
    Ok i solve the problem I've posted before,I run the web app..It
    creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>


    Hi.At step 2 I have only 3 files in the folder,but i think is
    not a
    problema.I've tried to create the index in the web app e not
    only in
    the
    standalone application but something failes.Tomcat report this
    error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at
    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run
    (SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open
    (DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open
    (IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open
    (IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>
    (IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown
    Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke
    (NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke
    (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:
    1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:
    1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>


    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace
    whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software,
    recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like
    this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52
    segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52
    segments.gen

    You have now confirmed that you are actually creating
    indexes. And
    the
    indexes you are creating exist at EXACTLY the place you have
    asked
    them
    to.

    Step 3: Then.. go download luke, and open these indexes.
    Perform a
    query
    on them, confirm that the data you want is actually IN the
    indexes.

    Step 4: Now, open up your standalone application, and replace
    whatever
    you
    are using in the to open the index with the SAME string I have
    listed
    above.

    Perform a search, verify that the indexes are there, and
    actually
    return
    values.

    Step 5: Lastly, go into your web application and again
    replace the
    path
    with the one I have above, recompile, and perform a search.
    Verify
    that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely
    pointing to
    some
    other issues in what you have setup. For example your tomcat
    instance
    could
    perhaps not have permission to read the lucene indexes
    directory.
    You
    should be able to tell this in the tomcat logs, BUT don't do
    this
    yet.
    Carefully and fully follow the steps I have outlined for
    you, and
    then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer
    look
    at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the
    above
    outlined process failed for you, as that will be really really
    helpful.

    Matt



    Marco Lazzara wrote:


    I dont't know hot to solve the problem..I've tried all
    rationals
    things.Maybe the last thing is to try to index not with
    FSDirectory
    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>




    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:




    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an
    index in
    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>






    For writing indexes?

    Well I guess it depends on what you want.. but I
    personally use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever
    lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue
    here.
    Looking at your "full path" example those still seem to
    be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I
    mean by
    that,

    Lets say you are running your program in the following
    directory:
    /home/test/app/

    Trying to open an index like you have below will
    effectively be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:






    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look
    again at
    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>








    OK. I'd still like to see some evidence, but never mind.

    Next suggestion is the old standby - cut the code down
    to the
    absolute
    minimum to demonstrate the problem and post it here. I
    know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:







    _I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is
    changed.
    MARCOLAZZARA
    _

    _







    Its been a few days, and we haven't heard back about
    this
    issue,
    can
    we assume that you fixed it via using fully qualified
    paths
    then?

    Matt

    Ian Lea wrote:







    Marco


    You haven't answered Matt's question about where you
    are
    running
    it
    from. Tomcat's default directory may well not be
    the same
    as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the
    same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:








    I've posted the indexing part,but I don't use this
    in my
    app.After
    I
    create the index,I put that in a folder like






    /home/marco/RDFIndexLucece




    and when I run the query I'm only searching (and not
    indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};



    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);

    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text,
    "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara








    Sorry, anyhow looking over this quickly here's a
    summarization
    of






    what




    I see:
    You have documents in your index that look like the
    following:


    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not
    indexed

    For an analyzer you are using Standard analyzer
    (which
    considering






    all




    the Italian? is an interesting choice.)
    And you are opening your index using FSDirectory, in
    what
    appears
    to



    be a by reference fashion (You don't have a fully
    qualified
    path

    to
    where your index is, you are ASSUMING that its in the
    same
    directory
    as this code, unless FSDirectory is not
    implemented as I
    think
    it






    is.)




    Now can I see the consumer code? Specifically the part
    where
    you
    are




    opening the index/constructing your queries?



    I'm betting what's going on here is you are
    deploying this
    as
    a

    war
    file into tomcat, and its just not really finding the
    index
    as
    a
    result of how the war file is getting deployed, but
    looking
    more
    closely at the source code should reveal if my
    suspicion
    is
    correct
    here.

    Also runtime wise, when you run your standalone app,
    where
    specifically in your directory structure are you
    running
    it
    from?
    Cause if you are opening your index reader/
    searcher in
    the
    same
    way






    as




    you are creating your writer here, I'm pretty darn
    certain
    that
    will




    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query
    Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and
    for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new






    RDFinder("RDFIndexLucene/",new




    String[] {"name"});
    // public boolean Exists(String node) throws
    ParseException,


    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String
    inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare
    analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis
    (inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector
    ();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura
    dell'indice
    //Tale istanza viene fornita di analyzer, di un
    boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o
    infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory,
    analyzer, true,
    new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:






    un




    documento per nodo
    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione
    (Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node))
    break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field
    ("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms
    (node);
    for (int is = 0; is <
    nodesynonyms.length; is++)
    {
    field = new Field
    ("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path
    minimali





    dalle




    sorgenti al nodo
    // non indicizzati



    for (int j = 0; j < sourcesize; j
    ++) {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size
    (); ii++)
    {
    String pp =
    rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    }
    catch (IllegalArgumentException e){
    System.out.println("source: "+source+ "
    node:
    "+node);
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    }
    // proprietˆ entranti
    // indicizzati
    //versione con i sinonimi
    ArrayList<String> y =
    rs.getInProperty(node);
    if (y != null) {

    for (int j = 0; j < y.size(); j++) {
    String propin = y.get(j);
    field = new Field("propIn", propin,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    String[] propinsynonyms =
    wns.getSynonyms(propin);
    for (int is = 0; is <
    propinsynonyms.length;
    is++) {
    field = new Field
    ("propIn",
    propinsynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    }
    // un campo num_propIn: numero di
    proprietˆ
    entranti
    // non indicizzato
    String num_propIN =
    String.valueOf(y.size());
    field = new Field("num_propIn",
    num_propIN,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else {
    String num_propIN =






    String.valueOf(0);




    field = new Field
    ("num_propIn",
    num_propIN,



    Field.Store.YES, Field.Index.NO);

    doc.add(field);
    }
    // i vicini del nodo
    ArrayList<String> v =
    rs.getVicini(node);
    if (v != null) {

    for (int j = 0; j < v.size(); j++) {
    String vicino = v.get(j);
    field = new Field("vicini", vicino,
    Field.Store.YES,
    Field.Index.ANALYZED);
    doc.add(field);
    }
    }
    //
    aggiunta






    documento




    all'indice
    iwriter.addDocument(doc);



    }

    iwriter.close();
    directory.close();
    }
    public int getNR(){
    return rs.NumResource();
    }


    }

    MARCO LAZZARA










    Things that could help us immensely here.

    Can you post your indexReader/Searcher
    initialization
    code
    from






    your




    standalone app, as well as your webapp.
    Could you further post your Analyzer Setup/Query
    Building
    code


    from

    both apps.
    Could you further post the document creation
    code used
    at
    indexing
    time? (Which analyzer, and which fields are
    indexed/stored)
    Give us this, and I'm pretty darn sure we can
    nail down
    your
    issue.

    Matt

    Ian Lea wrote:









    ...





    There are no exceptions.When I run the query a
    new
    shell
    is
    displayed but
    with no result.








    New shell?











    _*Are you sure the index is the same - what do
    IndexReader.maxDoc(),
    numDocs() and getVersion() say, standalone
    and in tomcat?

    *_What do you mean with this question??








    IndexReader ir = ...
    System.out.printf("maxDoc=%s, ...", ir.maxDoc
    (), ...);

    and run in tomcat and standalone. To absolutely
    confirm
    you're
    looking at the same index, and it has
    documents, etc.


    --
    Ian.








    --------------------------------------------------------------------
    -






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:



    java-user-help@lucene.apache.org






    --------------------------------------------------------------------
    -






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:
    java-user-help@lucene.apache.org



    __________ Information from ESET NOD32 Antivirus,
    version
    of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    __________ Information from ESET NOD32 Antivirus,
    version
    of
    virus
    signature database 4087 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com










    --------------------------------------------------------------------
    -






    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org




    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus,
    version
    of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com









    __________ Information from ESET NOD32 Antivirus,
    version
    of
    virus
    signature database 4088 (20090519) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com





    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org









    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org




    __________ Information from ESET NOD32 Antivirus,
    version of
    virus
    signature database 4093 (20090521) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com








    __________ Information from ESET NOD32 Antivirus,
    version of
    virus






    signature database 4094 (20090521) __________







    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com




    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org








    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail:
    java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org







    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail: java-user-
    unsubscribe@lucene.apache.org
    For additional commands, e-mail:
    java-user-help@lucene.apache.org





    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail: java-user-
    unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-
    help@lucene.apache.org




    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-
    help@lucene.apache.org



    --
    Matthew Hall
    Software Engineer
    Mouse Genome Informatics
    mhall@informatics.jax.org
    (207) 288-6012



    -------------------------------------------------------------------
    --
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 27, 2009 at 3:49 pm
    I attache the file testIndex.zip.Run the query with : PHILIPCIMIANO, or
    RESEARCHER.

    I use StandardAnalyzer.Is it a problem?

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>
    Not sure if this applies here, but that tends to happen when the analyzer
    you use for indexing is different from the one used in Luke or you're
    running into character set issues. Are you using the StandardAnalyzer in
    both cases?

    Also, could you post an example of the query you are trying? There are
    some very smart people who check this list and they may be able to help you
    if they had a "sample" of your index, i.e., create a 10-document index and
    make it available for download so people can look at it for you?

    -h

    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but does Luke
    recognize those files as an index and do you see the Documents you expect
    to
    see in this index?*
    Luke recognizes those files and I see those documents in this index but I
    observed that when I run the query Luke finds (for example) only 3 files
    of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>

    Sorry for the confusion -- I checked the archive and I could not find a
    message where you have been able to open the index using Luke.

    Have you been able to do that? I see that you have reported the creation
    of 3 files, but does Luke recognize those files as an index and do you
    see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>

    Marco,

    Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the answer from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data
    that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the web
    application,I tried to create the index with a webapp and the index was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp cathces an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it fails..maybe the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>

    Right.. so perhaps I'm a bit confused here.
    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you
    were
    using to first build your indexes, which the webapp then consumes.
    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over here.



    Marco Lazzara wrote:

    Ok i solve the problem I've posted before,I run the web app..It
    creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>



    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in
    the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at

    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at

    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    humor me.
    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace
    whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software,
    recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And
    the
    indexes you are creating exist at EXACTLY the place you have asked
    them
    to.
    Step 3: Then.. go download luke, and open these indexes. Perform a
    query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace
    whatever
    you
    are using in the to open the index with the SAME string I have
    listed
    above.
    Perform a search, verify that the indexes are there, and actually
    return
    values.
    Step 5: Lastly, go into your web application and again replace the
    path
    with the one I have above, recompile, and perform a search. Verify
    that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing to
    some
    other issues in what you have setup. For example your tomcat
    instance
    could
    perhaps not have permission to read the lucene indexes directory.
    You
    should be able to tell this in the tomcat logs, BUT don't do this
    yet.
    Carefully and fully follow the steps I have outlined for you, and
    then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look
    at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.
    Matt



    Marco Lazzara wrote:



    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with FSDirectory
    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>





    because that's the default index write behavior.
    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:





    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index in
    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>







    For writing indexes?
    Well I guess it depends on what you want.. but I personally use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.
    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by
    that,

    Lets say you are running your program in the following
    directory:
    /home/test/app/

    Trying to open an index like you have below will effectively be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:







    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again at
    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>









    OK. I'd still like to see some evidence, but never mind.
    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:








    _I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.
    MARCOLAZZARA
    _

    _








    Its been a few days, and we haven't heard back about this
    issue,
    can
    we assume that you fixed it via using fully qualified paths
    then?

    Matt

    Ian Lea wrote:








    Marco

    You haven't answered Matt's question about where you are
    running
    it
    from. Tomcat's default directory may well not be the same
    as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:









    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like








    /home/marco/RDFIndexLucece





    and when I run the query I'm only searching (and not
    indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};




    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);


    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara









    Sorry, anyhow looking over this quickly here's a
    summarization
    of








    what





    I see:

    You have documents in your index that look like the

    following:


    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering








    all





    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what
    appears
    to




    be a by reference fashion (You don't have a fully
    qualified
    path

    to
    where your index is, you are ASSUMING that its in the
    same
    directory
    as this code, unless FSDirectory is not implemented as I
    think
    it








    is.)





    Now can I see the consumer code? Specifically the part
    where
    you

    are





    opening the index/constructing your queries?



    I'm betting what's going on here is you are deploying this
    as
    a

    war
    file into tomcat, and its just not really finding the
    index
    as
    a
    result of how the war file is getting deployed, but
    looking
    more
    closely at the source code should reveal if my suspicion
    is
    correct
    here.

    Also runtime wise, when you run your standalone app,
    where
    specifically in your directory structure are you running
    it
    from?
    Cause if you are opening your index reader/searcher in
    the
    same
    way








    as





    you are creating your writer here, I'm pretty darn
    certain that
    will





    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query
    Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new








    RDFinder("RDFIndexLucene/",new





    String[] {"name"});

    // public boolean Exists(String node) throws

    ParseException,


    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare
    analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura
    dell'indice
    //Tale istanza viene fornita di analyzer, di un
    boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o
    infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true,
    new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:








    un





    documento per nodo

    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node))
    break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++)
    {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali






    dalle





    sorgenti al nodo

    // non indicizzati



    for (int j = 0; j < sourcesize; j++) {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++)
    {
    String pp =
    rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    ...
    [Messaggio troncato]
  • Erick Erickson at May 27, 2009 at 4:13 pm
    StandardAnalyzer is fine. I loaded your index into Luke and there is exactly
    one document with philipcimiano in the name field.
    There is only one document that has researcher in the name field.
    Both of these documents (using StandardAnalyzer) return one
    document (doc 12 for PHILIPCIMIANO and doc 4 for RESEARCHER)
    as I would expect.

    So what is the behavior you expect?

    Best
    Erick
    On Wed, May 27, 2009 at 11:47 AM, Marco Lazzara wrote:

    I attache the file testIndex.zip.Run the query with : PHILIPCIMIANO, or
    RESEARCHER.

    I use StandardAnalyzer.Is it a problem?

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>
    Not sure if this applies here, but that tends to happen when the analyzer
    you use for indexing is different from the one used in Luke or you're
    running into character set issues. Are you using the StandardAnalyzer in
    both cases?

    Also, could you post an example of the query you are trying? There are
    some very smart people who check this list and they may be able to help you
    if they had a "sample" of your index, i.e., create a 10-document index and
    make it available for download so people can look at it for you?

    -h

    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but does Luke
    recognize those files as an index and do you see the Documents you expect
    to
    see in this index?*
    Luke recognizes those files and I see those documents in this index but I
    observed that when I run the query Luke finds (for example) only 3 files
    of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>

    Sorry for the confusion -- I checked the archive and I could not find a
    message where you have been able to open the index using Luke.

    Have you been able to do that? I see that you have reported the
    creation
    of 3 files, but does Luke recognize those files as an index and do you
    see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the
    directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data
    that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>

    Marco,

    Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the
    directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the answer from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data
    that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the web
    application,I tried to create the index with a webapp and the index was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp cathces an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it fails..maybe the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>

    Right.. so perhaps I'm a bit confused here.
    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you
    were
    using to first build your indexes, which the webapp then consumes.
    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over here.



    Marco Lazzara wrote:

    Ok i solve the problem I've posted before,I run the web app..It
    creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>



    Hi.At step 2 I have only 3 files in the folder,but i think is not a
    problema.I've tried to create the index in the web app e not only in
    the
    standalone application but something failes.Tomcat report this error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at

    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at

    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    humor me.
    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace
    whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software,
    recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:

    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52 segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52 segments.gen

    You have now confirmed that you are actually creating indexes. And
    the
    indexes you are creating exist at EXACTLY the place you have asked
    them
    to.
    Step 3: Then.. go download luke, and open these indexes. Perform a
    query
    on them, confirm that the data you want is actually IN the indexes.

    Step 4: Now, open up your standalone application, and replace
    whatever
    you
    are using in the to open the index with the SAME string I have
    listed
    above.
    Perform a search, verify that the indexes are there, and actually
    return
    values.
    Step 5: Lastly, go into your web application and again replace the
    path
    with the one I have above, recompile, and perform a search. Verify
    that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing
    to
    some
    other issues in what you have setup. For example your tomcat
    instance
    could
    perhaps not have permission to read the lucene indexes directory.
    You
    should be able to tell this in the tomcat logs, BUT don't do this
    yet.
    Carefully and fully follow the steps I have outlined for you, and
    then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer look
    at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the above
    outlined process failed for you, as that will be really really helpful.
    Matt



    Marco Lazzara wrote:



    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with
    FSDirectory
    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>





    because that's the default index write behavior.
    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:





    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index
    in
    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>







    For writing indexes?
    Well I guess it depends on what you want.. but I personally use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever
    lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.
    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean by
    that,

    Lets say you are running your program in the following
    directory:
    /home/test/app/

    Trying to open an index like you have below will effectively be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:







    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again
    at
    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>









    OK. I'd still like to see some evidence, but never mind.
    Next suggestion is the old standby - cut the code down to the
    absolute
    minimum to demonstrate the problem and post it here. I know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:








    _I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.
    MARCOLAZZARA
    _

    _








    Its been a few days, and we haven't heard back about this
    issue,
    can
    we assume that you fixed it via using fully qualified paths
    then?

    Matt

    Ian Lea wrote:








    Marco

    You haven't answered Matt's question about where you are
    running
    it
    from. Tomcat's default directory may well not be the same
    as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:









    I've posted the indexing part,but I don't use this in my
    app.After
    I
    create the index,I put that in a folder like








    /home/marco/RDFIndexLucece





    and when I run the query I'm only searching (and not
    indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};




    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);


    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara









    Sorry, anyhow looking over this quickly here's a
    summarization
    of








    what





    I see:

    You have documents in your index that look like the

    following:


    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed

    For an analyzer you are using Standard analyzer (which
    considering








    all





    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what
    appears
    to




    be a by reference fashion (You don't have a fully
    qualified
    path

    to
    where your index is, you are ASSUMING that its in the
    same
    directory
    as this code, unless FSDirectory is not implemented as I
    think
    it








    is.)





    Now can I see the consumer code? Specifically the part
    where
    you

    are





    opening the index/constructing your queries?



    I'm betting what's going on here is you are deploying
    this
    as
    a

    war
    file into tomcat, and its just not really finding the
    index
    as
    a
    result of how the war file is getting deployed, but
    looking
    more
    closely at the source code should reveal if my suspicion
    is
    correct
    here.

    Also runtime wise, when you run your standalone app,
    where
    specifically in your directory structure are you running
    it
    from?
    Cause if you are opening your index reader/searcher in
    the
    same
    way








    as





    you are creating your writer here, I'm pretty darn
    certain that
    will





    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query
    Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new








    RDFinder("RDFIndexLucene/",new





    String[] {"name"});

    // public boolean Exists(String node) throws

    ParseException,


    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare
    analisi
    sul
    documento rdf
    rs = new AlternativeResourceAnalysis(inputfilename);

    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura
    dell'indice
    //Tale istanza viene fornita di analyzer, di un
    boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o
    infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer, true,
    new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:








    un





    documento per nodo

    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node))
    break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name", node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length; is++)
    {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali






    dalle





    sorgenti al nodo

    // non indicizzati



    for (int j = 0; j < sourcesize; j++) {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size(); ii++)
    {
    String pp =
    rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    ...
    [Messaggio troncato]



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 27, 2009 at 4:22 pm
    In my app I obtain 3 results.But I think is not a problem

    Marco Lazzara

    2009/5/27 Erick Erickson <erickerickson@gmail.com>
    StandardAnalyzer is fine. I loaded your index into Luke and there is
    exactly
    one document with philipcimiano in the name field.
    There is only one document that has researcher in the name field.
    Both of these documents (using StandardAnalyzer) return one
    document (doc 12 for PHILIPCIMIANO and doc 4 for RESEARCHER)
    as I would expect.

    So what is the behavior you expect?

    Best
    Erick

    On Wed, May 27, 2009 at 11:47 AM, Marco Lazzara <marco.lazzara@gmail.com
    wrote:
    I attache the file testIndex.zip.Run the query with : PHILIPCIMIANO, or
    RESEARCHER.

    I use StandardAnalyzer.Is it a problem?

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>
    Not sure if this applies here, but that tends to happen when the
    analyzer
    you use for indexing is different from the one used in Luke or you're
    running into character set issues. Are you using the StandardAnalyzer
    in
    both cases?

    Also, could you post an example of the query you are trying? There are
    some very smart people who check this list and they may be able to help
    you
    if they had a "sample" of your index, i.e., create a 10-document index
    and
    make it available for download so people can look at it for you?

    -h

    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but does Luke
    recognize those files as an index and do you see the Documents you
    expect
    to
    see in this index?*
    Luke recognizes those files and I see those documents in this index but
    I
    observed that when I run the query Luke finds (for example) only 3
    files
    of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>

    Sorry for the confusion -- I checked the archive and I could not find
    a
    message where you have been able to open the index using Luke.

    Have you been able to do that? I see that you have reported the
    creation
    of 3 files, but does Luke recognize those files as an index and do you
    see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the
    directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the
    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data
    that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>

    Marco,

    Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the
    directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the
    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data
    that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the web
    application,I tried to create the index with a webapp and the index
    was
    created without any problem.But the research has alway no result.

    For example,if the folder i'm searching on is empty, the webapp
    cathces
    an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it
    fails..maybe
    the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>

    Right.. so perhaps I'm a bit confused here.
    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you
    were
    using to first build your indexes, which the webapp then consumes.
    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday
    over
    here.



    Marco Lazzara wrote:

    Ok i solve the problem I've posted before,I run the web app..It
    creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>



    Hi.At step 2 I have only 3 files in the folder,but i think is not
    a
    problema.I've tried to create the index in the web app e not only
    in
    the
    standalone application but something failes.Tomcat report this
    error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at

    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at
    org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at

    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    humor me.
    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace
    whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software,
    recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like
    this:
    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52
    segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52
    segments.gen
    You have now confirmed that you are actually creating indexes.
    And
    the
    indexes you are creating exist at EXACTLY the place you have asked
    them
    to.
    Step 3: Then.. go download luke, and open these indexes. Perform
    a
    query
    on them, confirm that the data you want is actually IN the
    indexes.
    Step 4: Now, open up your standalone application, and replace
    whatever
    you
    are using in the to open the index with the SAME string I have
    listed
    above.
    Perform a search, verify that the indexes are there, and actually
    return
    values.
    Step 5: Lastly, go into your web application and again replace
    the
    path
    with the one I have above, recompile, and perform a search. Verify
    that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely pointing
    to
    some
    other issues in what you have setup. For example your tomcat
    instance
    could
    perhaps not have permission to read the lucene indexes directory.
    You
    should be able to tell this in the tomcat logs, BUT don't do this
    yet.
    Carefully and fully follow the steps I have outlined for you, and
    then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a closer
    look
    at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in the
    above
    outlined process failed for you, as that will be really really helpful.
    Matt



    Marco Lazzara wrote:



    I dont't know hot to solve the problem..I've tried all rationals
    things.Maybe the last thing is to try to index not with
    FSDirectory
    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>





    because that's the default index write behavior.
    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:





    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an index
    in
    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>







    For writing indexes?
    Well I guess it depends on what you want.. but I personally
    use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever
    lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue here.
    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean
    by
    that,

    Lets say you are running your program in the following
    directory:
    /home/test/app/

    Trying to open an index like you have below will effectively
    be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:







    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look again
    at
    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>









    OK. I'd still like to see some evidence, but never mind.
    Next suggestion is the old standby - cut the code down to
    the
    absolute
    minimum to demonstrate the problem and post it here. I
    know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:








    _I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is changed.
    MARCOLAZZARA
    _

    _








    Its been a few days, and we haven't heard back about this
    issue,
    can
    we assume that you fixed it via using fully qualified
    paths
    then?

    Matt

    Ian Lea wrote:








    Marco

    You haven't answered Matt's question about where you are
    running
    it
    from. Tomcat's default directory may well not be the
    same
    as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the
    same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:









    I've posted the indexing part,but I don't use this in
    my
    app.After
    I
    create the index,I put that in a folder like








    /home/marco/RDFIndexLucece





    and when I run the query I'm only searching (and not
    indexing).


    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};




    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);


    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text,
    "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara









    Sorry, anyhow looking over this quickly here's a
    summarization
    of








    what





    I see:

    You have documents in your index that look like the

    following:


    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not
    indexed
    For an analyzer you are using Standard analyzer (which
    considering








    all





    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in what
    appears
    to




    be a by reference fashion (You don't have a fully
    qualified
    path

    to
    where your index is, you are ASSUMING that its in the
    same
    directory
    as this code, unless FSDirectory is not implemented as
    I
    think
    it








    is.)





    Now can I see the consumer code? Specifically the
    part
    where
    you

    are





    opening the index/constructing your queries?



    I'm betting what's going on here is you are deploying
    this
    as
    a

    war
    file into tomcat, and its just not really finding the
    index
    as
    a
    result of how the war file is getting deployed, but
    looking
    more
    closely at the source code should reveal if my
    suspicion
    is
    correct
    here.

    Also runtime wise, when you run your standalone app,
    where
    specifically in your directory structure are you running
    it
    from?
    Cause if you are opening your index reader/searcher in
    the
    same
    way








    as





    you are creating your writer here, I'm pretty darn
    certain that
    will





    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/Query
    Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web and for
    standalone.
    And it is exactly the real problem!!the code is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new








    RDFinder("RDFIndexLucene/",new





    String[] {"name"});

    // public boolean Exists(String node) throws

    ParseException,


    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto per fare
    analisi
    sul
    documento rdf
    rs = new
    AlternativeResourceAnalysis(inputfilename);
    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura
    dell'indice
    //Tale istanza viene fornita di analyzer, di un
    boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o
    infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory, analyzer,
    true,
    new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con solo n
    documenti:








    un





    documento per nodo

    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione(Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains(node))
    break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field("name",
    node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms(node);
    for (int is = 0; is < nodesynonyms.length;
    is++)
    {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i: path minimali






    dalle





    sorgenti al nodo

    // non indicizzati



    for (int j = 0; j < sourcesize; j++)
    {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals(node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size();
    ii++)
    {
    String pp =
    rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    ...
    [Messaggio troncato]



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • N. Hira at May 27, 2009 at 5:02 pm
    Okay -- if the problem is not the number of results, then let's
    clarify the problem:

    1. You create an index in something like:
    /home/marco/testIndex

    2. You copy over the directory to something like:
    /home/marco/RDFIndexLucene

    3. When you run Tomcat, your "searcher" tries to open the index at
    2. above (using the full path, including the leading slash) and fails
    with:
    no segments* file found in org.apache.lucene.store


    Could you please confirm that this is the problem you are trying to
    resolve? If no, then please correct what I have stated above.

    -h
    On 27-May-2009, at 11:22 AM, Marco Lazzara wrote:

    In my app I obtain 3 results.But I think is not a problem

    Marco Lazzara

    2009/5/27 Erick Erickson <erickerickson@gmail.com>
    StandardAnalyzer is fine. I loaded your index into Luke and there is
    exactly
    one document with philipcimiano in the name field.
    There is only one document that has researcher in the name field.
    Both of these documents (using StandardAnalyzer) return one
    document (doc 12 for PHILIPCIMIANO and doc 4 for RESEARCHER)
    as I would expect.

    So what is the behavior you expect?

    Best
    Erick

    On Wed, May 27, 2009 at 11:47 AM, Marco Lazzara
    <marco.lazzara@gmail.com
    wrote:
    I attache the file testIndex.zip.Run the query with :
    PHILIPCIMIANO, or
    RESEARCHER.

    I use StandardAnalyzer.Is it a problem?

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>
    Not sure if this applies here, but that tends to happen when the
    analyzer
    you use for indexing is different from the one used in Luke or
    you're
    running into character set issues. Are you using the
    StandardAnalyzer
    in
    both cases?

    Also, could you post an example of the query you are trying?
    There are
    some very smart people who check this list and they may be able
    to help
    you
    if they had a "sample" of your index, i.e., create a 10-document
    index
    and
    make it available for download so people can look at it for you?

    -h

    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but
    does Luke
    recognize those files as an index and do you see the Documents you
    expect
    to
    see in this index?*
    Luke recognizes those files and I see those documents in this
    index but
    I
    observed that when I run the query Luke finds (for example) only 3
    files
    of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>

    Sorry for the confusion -- I checked the archive and I could
    not find
    a
    message where you have been able to open the index using Luke.

    Have you been able to do that? I see that you have reported the
    creation
    of 3 files, but does Luke recognize those files as an index
    and do you
    see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for
    searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the
    directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the
    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find
    the data
    that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>

    Marco,

    Does the part of the web app that is responsible for
    searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the
    directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the
    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find
    the data
    that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without
    the web
    application,I tried to create the index with a webapp and the
    index
    was
    created without any problem.But the research has alway no
    result.

    For example,if the folder i'm searching on is empty, the webapp
    cathces
    an
    exception : "no segments* file found in
    org.apache.lucene.store.
    RAMDirectory@home/marco/testIndex...."

    It means that Lucene tries to search in that index but it
    fails..maybe
    the
    index is incorrect for a webapp???

    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>

    Right.. so perhaps I'm a bit confused here.
    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software
    that you
    were
    using to first build your indexes, which the webapp then
    consumes.
    Is that your intent?

    Sorry I didn't get back to you before this, but it was a
    holiday
    over
    here.



    Marco Lazzara wrote:

    Ok i solve the problem I've posted before,I run the web
    app..It
    creates
    the
    index in folder /home/marco/testIndex with 3 files

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>



    Hi.At step 2 I have only 3 files in the folder,but i think
    is not
    a
    problema.I've tried to create the index in the web app e
    not only
    in
    the
    standalone application but something failes.Tomcat report this
    error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at

    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run
    (SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open
    (DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open
    (IndexReader.java:316)
    at
    org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown
    Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown
    Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    Method)
    at

    sun.reflect.NativeMethodAccessorImpl.invoke
    (NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke
    (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass
    (Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file
    found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    humor me.
    Open up your indexing software package.

    Step 1: In all places where you reference your index,
    replace
    whatever
    the
    heck you have there with the following EXACT STRING:

    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software,
    recompile
    and
    create your indexes.

    Step 2: After your indexing process completes do the
    following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like
    this:
    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47
    _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50
    _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50
    _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52
    _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52
    _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52
    _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52
    _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52
    _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52
    segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52
    segments.gen
    You have now confirmed that you are actually creating
    indexes.
    And
    the
    indexes you are creating exist at EXACTLY the place you
    have asked
    them
    to.
    Step 3: Then.. go download luke, and open these indexes.
    Perform
    a
    query
    on them, confirm that the data you want is actually IN the
    indexes.
    Step 4: Now, open up your standalone application, and
    replace
    whatever
    you
    are using in the to open the index with the SAME string I
    have
    listed
    above.
    Perform a search, verify that the indexes are there, and
    actually
    return
    values.
    Step 5: Lastly, go into your web application and again
    replace
    the
    path
    with the one I have above, recompile, and perform a
    search. Verify
    that
    the
    indexes are actually THERE and searchable.

    This.. damn well SHOULD work, if it doesn't it is likely
    pointing
    to
    some
    other issues in what you have setup. For example your
    tomcat
    instance
    could
    perhaps not have permission to read the lucene indexes
    directory.
    You
    should be able to tell this in the tomcat logs, BUT don't do
    this
    yet.
    Carefully and fully follow the steps I have outlined for
    you, and
    then
    you
    have chased down the full debugging path for this.

    If this yields nothing for you, I'd be happy to take a
    closer
    look
    at
    your
    source code, but until then give this a shot.

    Oh.. if it fails, please post back EXACTLY which steps in
    the
    above
    outlined process failed for you, as that will be really
    really helpful.
    Matt



    Marco Lazzara wrote:



    I dont't know hot to solve the problem..I've tried all
    rationals
    things.Maybe the last thing is to try to index not with
    FSDirectory
    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>





    because that's the default index write behavior.
    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:





    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open
    an index
    in
    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>







    For writing indexes?
    Well I guess it depends on what you want.. but I
    personally
    use
    this:

    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/
    thisismyindexdirectory"
    Analyzer analyzer = new
    WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of
    whatever
    lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual
    issue here.
    Looking at your "full path" example those still seem
    to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what
    I mean
    by
    that,

    Lets say you are running your program in the following
    directory:
    /home/test/app/

    Trying to open an index like you have below will
    effectively
    be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the
    entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:







    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please
    look again
    at
    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>









    OK. I'd still like to see some evidence, but never
    mind.
    Next suggestion is the old standby - cut the code
    down to
    the
    absolute
    minimum to demonstrate the problem and post it
    here. I
    know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.


    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:








    _I strongly suggest that you use a full path name
    and/or
    provide
    some
    evidence that your readers and writers are using
    the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But
    nothing is changed.
    MARCOLAZZARA
    _

    _








    Its been a few days, and we haven't heard back
    about this
    issue,
    can
    we assume that you fixed it via using fully
    qualified
    paths
    then?

    Matt

    Ian Lea wrote:








    Marco

    You haven't answered Matt's question about where
    you are
    running
    it
    from. Tomcat's default directory may well not
    be the
    same
    as
    yours.
    I strongly suggest that you use a full path name
    and/or
    provide
    some
    evidence that your readers and writers are using
    the
    same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:









    I've posted the indexing part,but I don't use
    this in
    my
    app.After
    I
    create the index,I put that in a folder like








    /home/marco/RDFIndexLucece





    and when I run the query I'm only searching
    (and not
    indexing).


    String[] fieldsearch = new String[] {"name",
    "synonyms",
    "propIn"};




    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);


    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text,
    "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara









    Sorry, anyhow looking over this quickly here's a
    summarization
    of








    what





    I see:

    You have documents in your index that look like the

    following:


    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not
    indexed
    For an analyzer you are using Standard
    analyzer (which
    considering








    all





    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory,
    in what
    appears
    to




    be a by reference fashion (You don't have a fully
    qualified
    path

    to
    where your index is, you are ASSUMING that its
    in the
    same
    directory
    as this code, unless FSDirectory is not
    implemented as
    I
    think
    it








    is.)





    Now can I see the consumer code? Specifically
    the
    part
    where
    you

    are





    opening the index/constructing your queries?



    I'm betting what's going on here is you are
    deploying
    this
    as
    a

    war
    file into tomcat, and its just not really
    finding the
    index
    as
    a
    result of how the war file is getting
    deployed, but
    looking
    more
    closely at the source code should reveal if my
    suspicion
    is
    correct
    here.

    Also runtime wise, when you run your
    standalone app,
    where
    specifically in your directory structure are you running
    it
    from?
    Cause if you are opening your index reader/
    searcher in
    the
    same
    way








    as





    you are creating your writer here, I'm pretty
    darn
    certain that
    will





    cause you problems.



    Matt

    Marco Lazzara wrote:








    _Could you further post your Analyzer Setup/
    Query
    Building
    code
    from
    BOTH apps. _

    there is only one code.It is the same for web
    and for
    standalone.
    And it is exactly the real problem!!the code
    is the
    same,libraries
    are
    the same,query index etc etc. are the same.

    This is the class that create index


    public class AlternativeRDFIndexing {
    private Analyzer analyzer;
    private Directory directory;
    private IndexWriter iwriter;
    private WordNetSynonymEngine wns;
    private AlternativeResourceAnalysis rs;
    public ArrayList<String> commonnodes;
    //private RDFinder rdfind = new








    RDFinder("RDFIndexLucene/",new





    String[] {"name"});

    // public boolean Exists(String node) throws

    ParseException,


    IOException{

    // // return rdfind.Exists(node);
    // }
    public AlternativeRDFIndexing(String
    inputfilename)
    throws
    IOException, ParseException{
    commonnodes = new ArrayList<String>();
    // bisogna istanziare un oggetto
    per fare
    analisi
    sul
    documento rdf
    rs = new
    AlternativeResourceAnalysis(inputfilename);
    ArrayList<String> nodelist =
    rs.getResources();
    int nodesize = nodelist.size();
    ArrayList<String> sourcelist = rs.getsource
    ();
    int sourcesize = sourcelist.size();
    //sinonimi
    wns = new WordNetSynonymEngine("sinonimi/");
    //creazione di un analyzer standard
    analyzer = new StandardAnalyzer();

    //Memorizza l'indice in RAM:
    //Directory directory = new
    RAMDirector();
    //Memorizza l'indice su file
    directory =
    FSDirectory.getDirectory("RDFIndexLucene/");
    //Creazione istanza per la scrittura
    dell'indice
    //Tale istanza viene fornita di analyzer, di un
    boolean
    per
    indicare se ricreare o meno da zero
    //la struttura e di una dimensione massima (o
    infinita
    IndexWriter.MaxFieldLength.UNLIMITED)
    iwriter = new IndexWriter(directory,
    analyzer,
    true,
    new
    IndexWriter.MaxFieldLength(25000));
    //costruiamo un indice con
    solo n
    documenti:








    un





    documento per nodo

    for (int i = 0; i < nodesize; i++){



    Document doc = new Document();

    //creazione dei vari campi
    // ogni documento avrˆ
    // un campo name: nome del nodo
    // indicazione di memorizzazione
    (Store.YES) e
    indicizzazione
    con analyzer(ANALYZED)
    String node = nodelist.get(i);
    //if (sourcelist.contains
    (node))
    break;
    //if (rdfind.Exists(node))
    commonnodes.add(node);
    Field field = new Field
    ("name",
    node,
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    //Aggiungo i sinonimi
    String[] nodesynonyms = wns.getSynonyms
    (node);
    for (int is = 0; is <
    nodesynonyms.length;
    is++)
    {
    field = new Field("synonyms",
    nodesynonyms[is],
    Field.Store.YES,Field.Index.ANALYZED);
    //Aggiunta campo al documento
    doc.add(field);
    }
    // uno o piu campi path_i:
    path minimali






    dalle





    sorgenti al nodo

    // non indicizzati



    for (int j = 0; j <
    sourcesize; j++)
    {

    String source = sourcelist.get(j);
    ArrayList<LinkedList<String>> path = new
    ArrayList<LinkedList<String>>();
    try{
    if ((source.equals
    (node)) ||
    (sourcelist.contains(node))){
    field = new Field("path", "null",
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    else{
    path = rs.getPaths(source, node);
    for (int ii = 0; ii < path.size
    ();
    ii++)
    {
    String pp =
    rs.getPath(path.get(ii));
    field = new Field("path", pp,
    Field.Store.YES,
    Field.Index.NO);
    doc.add(field);
    }
    ...
    [Messaggio troncato]



    --------------------------------------------------------------------
    -
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ----------------------------------------------------------------------
    Hira, N.R.
    Cognocys, Inc.
    (773) 251-7453

    Catch up on the news. http://www.cognocys.com/prospector/news.html






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 27, 2009 at 5:14 pm
    NO.the app creates the index in a folder and I run the query in that
    folder.
    For example if I decide to create the folder in /home/marco/testIndex
    ,obviously I run the query on /home/marco/testIndex
    if I decide to create the folder in /home/marco/RDFLUCENE ,obviously I run
    the query on /home/marco/RDFLUCENE
    But I ALWAYS obtain no results.


    In order to understand how tomcat works with lucene I made an experiment: I
    deleted all files in the index and I tried to run the query in the empty
    folder and It fails with:
    no segments* file found in org.apache.lucene.store

    It means that Lucene recognizes the index (when it isn't empty) but on the
    webapp It obtains no result

    Marco Lazzara


    2009/5/27 N. Hira <nhira@cognocys.com>
    Okay -- if the problem is not the number of results, then let's clarify the
    problem:

    1. You create an index in something like:
    /home/marco/testIndex

    2. You copy over the directory to something like:
    /home/marco/RDFIndexLucene

    3. When you run Tomcat, your "searcher" tries to open the index at 2.
    above (using the full path, including the leading slash) and fails with:
    no segments* file found in org.apache.lucene.store


    Could you please confirm that this is the problem you are trying to
    resolve? If no, then please correct what I have stated above.

    -h


    On 27-May-2009, at 11:22 AM, Marco Lazzara wrote:

    In my app I obtain 3 results.But I think is not a problem
    Marco Lazzara

    2009/5/27 Erick Erickson <erickerickson@gmail.com>

    StandardAnalyzer is fine. I loaded your index into Luke and there is
    exactly
    one document with philipcimiano in the name field.
    There is only one document that has researcher in the name field.
    Both of these documents (using StandardAnalyzer) return one
    document (doc 12 for PHILIPCIMIANO and doc 4 for RESEARCHER)
    as I would expect.

    So what is the behavior you expect?

    Best
    Erick

    On Wed, May 27, 2009 at 11:47 AM, Marco Lazzara <marco.lazzara@gmail.com
    wrote:
    I attache the file testIndex.zip.Run the query with : PHILIPCIMIANO, or
    RESEARCHER.

    I use StandardAnalyzer.Is it a problem?

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>

    Not sure if this applies here, but that tends to happen when the
    analyzer
    you use for indexing is different from the one used in Luke or you're
    running into character set issues. Are you using the StandardAnalyzer
    in
    both cases?
    Also, could you post an example of the query you are trying? There are
    some very smart people who check this list and they may be able to help
    you
    if they had a "sample" of your index, i.e., create a 10-document index
    and
    make it available for download so people can look at it for you?
    -h

    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but does Luke
    recognize those files as an index and do you see the Documents you
    expect
    to
    see in this index?*
    Luke recognizes those files and I see those documents in this index
    but
    I
    observed that when I run the query Luke finds (for example) only 3
    files
    of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>


    Sorry for the confusion -- I checked the archive and I could not find
    a
    message where you have been able to open the index using Luke.
    Have you been able to do that? I see that you have reported the
    creation
    of 3 files, but does Luke recognize those files as an index and do
    you
    see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the
    directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the
    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data
    that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>


    Marco,
    Does the part of the web app that is responsible for searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the
    directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data
    that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the
    web
    application,I tried to create the index with a webapp and the index
    was
    created without any problem.But the research has alway no result.
    For example,if the folder i'm searching on is empty, the webapp cathces
    an
    exception : "no segments* file found in
    org.apache.lucene.store.

    RAMDirectory@home/marco/testIndex...."
    It means that Lucene tries to search in that index but it
    fails..maybe
    the
    index is incorrect for a webapp???
    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>

    Right.. so perhaps I'm a bit confused here.
    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that you

    were
    using to first build your indexes, which the webapp then consumes.
    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday over
    here.


    Marco Lazzara wrote:

    Ok i solve the problem I've posted before,I run the web app..It
    creates
    the
    index in folder /home/marco/testIndex with 3 files
    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>



    Hi.At step 2 I have only 3 files in the folder,but i think is not
    a
    problema.I've tried to create the index in the web app e not only
    in
    the
    standalone application but something failes.Tomcat report this
    error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at


    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at
    org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at


    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    humor me.
    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace

    whatever
    the
    heck you have there with the following EXACT STRING:
    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software,

    recompile
    and
    create your indexes.
    Step 2: After your indexing process completes do the following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like this:
    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52
    segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52
    segments.gen
    You have now confirmed that you are actually creating indexes. And
    the
    indexes you are creating exist at EXACTLY the place you have asked
    them
    to.
    Step 3: Then.. go download luke, and open these indexes.
    Perform
    a
    query
    on them, confirm that the data you want is actually IN the indexes.
    Step 4: Now, open up your standalone application, and replace

    whatever
    you
    are using in the to open the index with the SAME string I have
    listed
    above.
    Perform a search, verify that the indexes are there, and
    actually

    return
    values.
    Step 5: Lastly, go into your web application and again replace the
    path
    with the one I have above, recompile, and perform a search.
    Verify
    that
    the
    indexes are actually THERE and searchable.
    This.. damn well SHOULD work, if it doesn't it is likely
    pointing
    to
    some
    other issues in what you have setup. For example your tomcat

    instance
    could
    perhaps not have permission to read the lucene indexes directory.
    You
    should be able to tell this in the tomcat logs, BUT don't do this
    yet.
    Carefully and fully follow the steps I have outlined for you, and
    then
    you
    have chased down the full debugging path for this.
    If this yields nothing for you, I'd be happy to take a closer look
    at
    your
    source code, but until then give this a shot.
    Oh.. if it fails, please post back EXACTLY which steps in the
    above
    outlined process failed for you, as that will be really really
    helpful.
    Matt



    Marco Lazzara wrote:



    I dont't know hot to solve the problem..I've tried all
    rationals
    things.Maybe the last thing is to try to index not with
    FSDirectory

    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>





    because that's the default index write behavior.
    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:





    ok.I understand what you really mean but It doesn't work.
    I understand one thing.For example When i try to open an
    index
    in

    the
    following location : "RDFIndexLucene/" but the folder doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>







    For writing indexes?
    Well I guess it depends on what you want.. but I personally
    use
    this:
    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever
    lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual issue

    here.
    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I mean
    by
    that,
    Lets say you are running your program in the following

    directory:
    /home/test/app/
    Trying to open an index like you have below will effectively
    be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:







    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please look
    again
    at

    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>









    OK. I'd still like to see some evidence, but never mind.
    Next suggestion is the old standby - cut the code down to
    the
    absolute
    minimum to demonstrate the problem and post it here. I
    know
    you've
    already posted some code, but maybe not all of it, and

    definitely
    not
    cut down to the absolute minimum.

    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:








    _I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is

    changed.
    MARCOLAZZARA
    _

    _








    Its been a few days, and we haven't heard back about
    this
    issue,
    can
    we assume that you fixed it via using fully qualified
    paths
    then?
    Matt

    Ian Lea wrote:








    Marco

    You haven't answered Matt's question about where you
    are
    running
    it
    from. Tomcat's default directory may well not be the same
    as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the
    same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:









    I've posted the indexing part,but I don't use this in
    my
    app.After
    I
    create the index,I put that in a folder like








    /home/marco/RDFIndexLucece





    and when I run the query I'm only searching (and not
    indexing).

    String[] fieldsearch = new String[] {"name", "synonyms",
    "propIn"};




    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);


    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text,
    "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara









    Sorry, anyhow looking over this quickly here's a
    summarization
    of








    what





    I see:

    You have documents in your index that look like the
    following:

    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not indexed
    For an analyzer you are using Standard analyzer
    (which
    considering








    all





    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in
    what
    appears
    to




    be a by reference fashion (You don't have a fully
    qualified
    path
    to
    where your index is, you are ASSUMING that its in the
    same
    directory
    as this code, unless FSDirectory is not implemented as
    I
    think
    it








    is.)





    Now can I see the consumer code? Specifically the
    part
    ...
    [Messaggio troncato]
  • N. Hira at May 27, 2009 at 5:34 pm
    Okay -- that helps.

    So we know that searching the same files with Luke works, but with
    the web app does not. Can you please re-post the fragment of code
    that opens your index and uses the query?

    If you haven't already done this, could you also use query.toString()
    to confirm the query?

    Thanks.

    -h

    On 27-May-2009, at 12:14 PM, Marco Lazzara wrote:

    NO.the app creates the index in a folder and I run the query in that
    folder.
    For example if I decide to create the folder in /home/marco/testIndex
    ,obviously I run the query on /home/marco/testIndex
    if I decide to create the folder in /home/marco/
    RDFLUCENE ,obviously I run
    the query on /home/marco/RDFLUCENE
    But I ALWAYS obtain no results.


    In order to understand how tomcat works with lucene I made an
    experiment: I
    deleted all files in the index and I tried to run the query in the
    empty
    folder and It fails with:
    no segments* file found in org.apache.lucene.store

    It means that Lucene recognizes the index (when it isn't empty) but
    on the
    webapp It obtains no result

    Marco Lazzara


    2009/5/27 N. Hira <nhira@cognocys.com>
    Okay -- if the problem is not the number of results, then let's
    clarify the
    problem:

    1. You create an index in something like:
    /home/marco/testIndex

    2. You copy over the directory to something like:
    /home/marco/RDFIndexLucene

    3. When you run Tomcat, your "searcher" tries to open the index
    at 2.
    above (using the full path, including the leading slash) and fails
    with:
    no segments* file found in org.apache.lucene.store


    Could you please confirm that this is the problem you are trying to
    resolve? If no, then please correct what I have stated above.

    -h


    On 27-May-2009, at 11:22 AM, Marco Lazzara wrote:

    In my app I obtain 3 results.But I think is not a problem
    Marco Lazzara

    2009/5/27 Erick Erickson <erickerickson@gmail.com>

    StandardAnalyzer is fine. I loaded your index into Luke and
    there is
    exactly
    one document with philipcimiano in the name field.
    There is only one document that has researcher in the name field.
    Both of these documents (using StandardAnalyzer) return one
    document (doc 12 for PHILIPCIMIANO and doc 4 for RESEARCHER)
    as I would expect.

    So what is the behavior you expect?

    Best
    Erick

    On Wed, May 27, 2009 at 11:47 AM, Marco Lazzara
    <marco.lazzara@gmail.com
    wrote:
    I attache the file testIndex.zip.Run the query with :
    PHILIPCIMIANO, or
    RESEARCHER.

    I use StandardAnalyzer.Is it a problem?

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>

    Not sure if this applies here, but that tends to happen when the
    analyzer
    you use for indexing is different from the one used in Luke or
    you're
    running into character set issues. Are you using the
    StandardAnalyzer
    in
    both cases?
    Also, could you post an example of the query you are trying?
    There are
    some very smart people who check this list and they may be
    able to help
    you
    if they had a "sample" of your index, i.e., create a 10-
    document index
    and
    make it available for download so people can look at it for you?
    -h

    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but
    does Luke
    recognize those files as an index and do you see the
    Documents you
    expect
    to
    see in this index?*
    Luke recognizes those files and I see those documents in this
    index
    but
    I
    observed that when I run the query Luke finds (for example) only 3
    files
    of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>


    Sorry for the confusion -- I checked the archive and I could
    not find
    a
    message where you have been able to open the index using Luke.
    Have you been able to do that? I see that you have reported
    the
    creation
    of 3 files, but does Luke recognize those files as an index
    and do
    you
    see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for
    searching have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the
    directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide
    the
    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find
    the data
    that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>


    Marco,
    Does the part of the web app that is responsible for
    searching have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the
    directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide
    the answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find
    the data
    that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index
    without the
    web
    application,I tried to create the index with a webapp and
    the index
    was
    created without any problem.But the research has alway no result.
    For example,if the folder i'm searching on is empty, the
    webapp cathces
    an
    exception : "no segments* file found in
    org.apache.lucene.store.

    RAMDirectory@home/marco/testIndex...."
    It means that Lucene tries to search in that index but it
    fails..maybe
    the
    index is incorrect for a webapp???
    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>

    Right.. so perhaps I'm a bit confused here.
    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software
    that you

    were
    using to first build your indexes, which the webapp then
    consumes.
    Is that your intent?

    Sorry I didn't get back to you before this, but it was a
    holiday over
    here.


    Marco Lazzara wrote:

    Ok i solve the problem I've posted before,I run the web
    app..It
    creates
    the
    index in folder /home/marco/testIndex with 3 files
    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>



    Hi.At step 2 I have only 3 files in the folder,but i
    think is not
    a
    problema.I've tried to create the index in the web app e not only
    in
    the
    standalone application but something failes.Tomcat report
    this
    error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at


    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run
    (SegmentInfos.java:604)
    at
    org.apache.lucene.index.DirectoryIndexReader.open
    (DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open
    (IndexReader.java:316)
    at
    org.apache.lucene.index.IndexReader.open(IndexReader.java:
    227)
    at
    org.apache.lucene.search.IndexSearcher.<init>
    (IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown
    Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    Method)
    at


    sun.reflect.NativeMethodAccessorImpl.invoke
    (NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke
    (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    com.sun.javaws.Launcher.executeApplication(Launcher.java:
    1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file
    found in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    humor me.
    Open up your indexing software package.

    Step 1: In all places where you reference your index,
    replace

    whatever
    the
    heck you have there with the following EXACT STRING:
    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing
    software,

    recompile
    and
    create your indexes.
    Step 2: After your indexing process completes do the
    following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something
    like this:
    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47
    _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50
    _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50
    _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52
    _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52
    _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52
    _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52
    _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52
    _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52
    segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52
    segments.gen
    You have now confirmed that you are actually creating
    indexes. And
    the
    indexes you are creating exist at EXACTLY the place you
    have asked
    them
    to.
    Step 3: Then.. go download luke, and open these indexes.
    Perform
    a
    query
    on them, confirm that the data you want is actually IN the indexes.
    Step 4: Now, open up your standalone application, and
    replace

    whatever
    you
    are using in the to open the index with the SAME string I
    have
    listed
    above.
    Perform a search, verify that the indexes are there, and
    actually

    return
    values.
    Step 5: Lastly, go into your web application and again
    replace the
    path
    with the one I have above, recompile, and perform a search.
    Verify
    that
    the
    indexes are actually THERE and searchable.
    This.. damn well SHOULD work, if it doesn't it is likely
    pointing
    to
    some
    other issues in what you have setup. For example your
    tomcat

    instance
    could
    perhaps not have permission to read the lucene indexes
    directory.
    You
    should be able to tell this in the tomcat logs, BUT don't
    do this
    yet.
    Carefully and fully follow the steps I have outlined for
    you, and
    then
    you
    have chased down the full debugging path for this.
    If this yields nothing for you, I'd be happy to take a
    closer look
    at
    your
    source code, but until then give this a shot.
    Oh.. if it fails, please post back EXACTLY which steps
    in the
    above
    outlined process failed for you, as that will be really really
    helpful.
    Matt



    Marco Lazzara wrote:



    I dont't know hot to solve the problem..I've tried all
    rationals
    things.Maybe the last thing is to try to index not with
    FSDirectory

    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>





    because that's the default index write behavior.
    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:





    ok.I understand what you really mean but It doesn't
    work.
    I understand one thing.For example When i try to
    open an
    index
    in

    the
    following location : "RDFIndexLucene/" but the folder
    doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my
    home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>







    For writing indexes?
    Well I guess it depends on what you want.. but I
    personally
    use
    this:
    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/
    thisismyindexdirectory"
    Analyzer analyzer = new
    WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/,
    true);

    Your best bet would be to peruse the API docs of
    whatever
    lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your
    actual issue

    here.
    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY
    what I mean
    by
    that,
    Lets say you are running your program in the following

    directory:
    /home/test/app/
    Trying to open an index like you have below will
    effectively
    be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its
    the entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:







    I was talking with my teacher.
    Is it correct to use FSDirectory?Could you please
    look
    again
    at

    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??

    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>









    OK. I'd still like to see some evidence, but
    never mind.
    Next suggestion is the old standby - cut the code
    down to
    the
    absolute
    minimum to demonstrate the problem and post it
    here. I
    know
    you've
    already posted some code, but maybe not all of
    it, and

    definitely
    not
    cut down to the absolute minimum.

    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:








    _I strongly suggest that you use a full path
    name and/or
    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/
    RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But
    nothing is

    changed.
    MARCOLAZZARA
    _

    _








    Its been a few days, and we haven't heard back
    about
    this
    issue,
    can
    we assume that you fixed it via using fully qualified
    paths
    then?
    Matt

    Ian Lea wrote:








    Marco

    You haven't answered Matt's question about
    where you
    are
    running
    it
    from. Tomcat's default directory may well not
    be the same
    as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the
    same
    directory
    and thus lucene index.


    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:









    I've posted the indexing part,but I don't use
    this in
    my
    app.After
    I
    create the index,I put that in a folder like








    /home/marco/RDFIndexLucece





    and when I run the query I'm only searching
    (and not
    indexing).

    String[] fieldsearch = new String[] {"name",
    "synonyms",
    "propIn"};




    //RDFinder rdfind = new
    RDFinder("RDFIndexLucene/",fieldsearch);


    TreeMap<Integer, ArrayList<String>> paths;
    try {
    this.paths = this.rdfind.Search(text,
    "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara









    Sorry, anyhow looking over this quickly
    here's a
    summarization
    of








    what





    I see:

    You have documents in your index that look like
    the
    following:

    name which is indexed and stored.

    synonyms which are indexed and stored
    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but
    not indexed
    For an analyzer you are using Standard analyzer
    (which
    considering








    all





    the Italian? is an interesting choice.)

    And you are opening your index using
    FSDirectory, in
    what
    appears
    to




    be a by reference fashion (You don't have a fully
    qualified
    path
    to
    where your index is, you are ASSUMING that
    its in the
    same
    directory
    as this code, unless FSDirectory is not implemented as
    I
    think
    it








    is.)





    Now can I see the consumer code?
    Specifically the
    part
    ...
    [Messaggio troncato]
    ----------------------------------------------------------------------
    Hira, N.R.
    Cognocys, Inc.
    (773) 251-7453

    Catch up on the news. http://www.cognocys.com/prospector/news.html






    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Marco Lazzara at May 27, 2009 at 5:40 pm
    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    RDFinder rdfind = new RDFinder("/home/marco/testIndex",fieldsearch);
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>
    Okay -- that helps.

    So we know that searching the same files with Luke works, but with the web
    app does not. Can you please re-post the fragment of code that opens your
    index and uses the query?

    If you haven't already done this, could you also use query.toString() to
    confirm the query?

    Thanks.

    -h



    On 27-May-2009, at 12:14 PM, Marco Lazzara wrote:

    NO.the app creates the index in a folder and I run the query in that
    folder.
    For example if I decide to create the folder in /home/marco/testIndex
    ,obviously I run the query on /home/marco/testIndex
    if I decide to create the folder in /home/marco/RDFLUCENE ,obviously I run
    the query on /home/marco/RDFLUCENE
    But I ALWAYS obtain no results.


    In order to understand how tomcat works with lucene I made an experiment:
    I
    deleted all files in the index and I tried to run the query in the empty
    folder and It fails with:
    no segments* file found in org.apache.lucene.store

    It means that Lucene recognizes the index (when it isn't empty) but on the
    webapp It obtains no result

    Marco Lazzara


    2009/5/27 N. Hira <nhira@cognocys.com>

    Okay -- if the problem is not the number of results, then let's clarify
    the
    problem:

    1. You create an index in something like:
    /home/marco/testIndex

    2. You copy over the directory to something like:
    /home/marco/RDFIndexLucene

    3. When you run Tomcat, your "searcher" tries to open the index at 2.
    above (using the full path, including the leading slash) and fails with:
    no segments* file found in org.apache.lucene.store


    Could you please confirm that this is the problem you are trying to
    resolve? If no, then please correct what I have stated above.

    -h


    On 27-May-2009, at 11:22 AM, Marco Lazzara wrote:

    In my app I obtain 3 results.But I think is not a problem
    Marco Lazzara

    2009/5/27 Erick Erickson <erickerickson@gmail.com>

    StandardAnalyzer is fine. I loaded your index into Luke and there is
    exactly
    one document with philipcimiano in the name field.
    There is only one document that has researcher in the name field.
    Both of these documents (using StandardAnalyzer) return one
    document (doc 12 for PHILIPCIMIANO and doc 4 for RESEARCHER)
    as I would expect.

    So what is the behavior you expect?

    Best
    Erick

    On Wed, May 27, 2009 at 11:47 AM, Marco Lazzara <
    marco.lazzara@gmail.com

    wrote:
    I attache the file testIndex.zip.Run the query with : PHILIPCIMIANO,
    or
    RESEARCHER.

    I use StandardAnalyzer.Is it a problem?

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>

    Not sure if this applies here, but that tends to happen when the
    analyzer
    you use for indexing is different from the one used in Luke or you're
    running into character set issues. Are you using the
    StandardAnalyzer

    in
    both cases?
    Also, could you post an example of the query you are trying? There
    are
    some very smart people who check this list and they may be able to
    help

    you
    if they had a "sample" of your index, i.e., create a 10-document index
    and
    make it available for download so people can look at it for you?
    -h

    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but does
    Luke

    recognize those files as an index and do you see the Documents you

    expect
    to
    see in this index?*
    Luke recognizes those files and I see those documents in this index
    but

    I
    observed that when I run the query Luke finds (for example) only 3
    files
    of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>


    Sorry for the confusion -- I checked the archive and I could not
    find
    a
    message where you have been able to open the index using Luke.
    Have you been able to do that? I see that you have reported the
    creation
    of 3 files, but does Luke recognize those files as an index and do
    you
    see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for searching
    have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print out the
    directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you provide the

    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the data
    that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>


    Marco,
    Does the part of the web app that is responsible for searching
    have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print out the
    directory
    listing to confirm?

    Also, I may have missed this posting, but could you provide the

    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find the
    data
    that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 3:45:38 PM
    Subject: Re: Searching index problems with tomcat

    I tried different things.I tried to create the index without the
    web
    application,I tried to create the index with a webapp and the
    index

    was
    created without any problem.But the research has alway no result.
    For example,if the folder i'm searching on is empty, the webapp

    cathces
    an
    exception : "no segments* file found in
    org.apache.lucene.store.


    RAMDirectory@home/marco/testIndex...."
    It means that Lucene tries to search in that index but it

    fails..maybe
    the
    index is incorrect for a webapp???
    MARCO LAZZARA


    2009/5/26 Matthew Hall <mhall@informatics.jax.org>

    Right.. so perhaps I'm a bit confused here.

    The webapp.. is consuming an index.. yes?

    Or, are you trying to create an index via a webapp?

    I was assuming that you had some sort of indexing software that
    you

    were
    using to first build your indexes, which the webapp then consumes.
    Is that your intent?

    Sorry I didn't get back to you before this, but it was a holiday

    over
    here.


    Marco Lazzara wrote:

    Ok i solve the problem I've posted before,I run the web app..It

    creates
    the
    index in folder /home/marco/testIndex with 3 files
    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen

    but when I run the query I obtain no results!!!!

    Why in my folder there are only 3 files???

    Marco Lazzara


    2009/5/24 Marco Lazzara <marco.lazzara@gmail.com>



    Hi.At step 2 I have only 3 files in the folder,but i think is
    not

    a
    problema.I've tried to create the index in the web app e not only
    in
    the
    standalone application but something failes.Tomcat report this
    error
    java.io.FileNotFoundException: no segments* file found in
    org.apache.lucene.store.RAMDirectory@1c2ec05: files:
    at




    org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:604)
    at

    org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
    at
    org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
    at
    org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
    at org.utils.synonym.WordNetSynonymEngine.<init>(Unknown Source)
    at org.indexing.AlternativeRDFIndexing.<init>(Unknown Source)
    at org.gui.CreazioneIndici.run2(Unknown Source)
    at org.gui.Query.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at




    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at

    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    com.sun.javaws.Launcher.executeApplication(Launcher.java:1321)
    at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1267)
    at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066)
    at com.sun.javaws.Launcher.run(Launcher.java:116)
    at java.lang.Thread.run(Thread.java:619)

    this changes everytime one time it is: no segments* file found
    in
    org.apache.lucene.store.RAMDirectory@*1c2ec05*
    the second it is no segments* file found in
    org.apache.lucene.store.RAMDirectory@*170b819*

    On the standalone it works perfectly.

    Marco Lazzara

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>



    humor me.

    Open up your indexing software package.

    Step 1: In all places where you reference your index, replace

    whatever
    the
    heck you have there with the following EXACT STRING:
    /home/marco/testIndex

    Do not leave off the leading slash.

    After you have made these changes to the indexing software,

    recompile
    and
    create your indexes.
    Step 2: After your indexing process completes do the
    following:

    cd /home/marco/testIndex/index

    You should see files in there, they will look something like

    this:
    drwxrwxr-x 3 mhall progs 4.0K May 18 11:19 ..
    -rw-rw-r-- 1 mhall progs 80 May 21 16:47 _9j7.fnm
    -rw-rw-r-- 1 mhall progs 4.1G May 21 16:50 _9j7.fdt
    -rw-rw-r-- 1 mhall progs 434M May 21 16:50 _9j7.fdx
    -rw-rw-r-- 1 mhall progs 280M May 21 16:52 _9j7.frq
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.prx
    -rw-rw-r-- 1 mhall progs 329M May 21 16:52 _9j7.tis
    -rw-rw-r-- 1 mhall progs 4.7M May 21 16:52 _9j7.tii
    -rw-rw-r-- 1 mhall progs 108M May 21 16:52 _9j7.nrm
    -rw-rw-r-- 1 mhall progs 47 May 21 16:52

    segments_9je
    -rw-rw-r-- 1 mhall progs 20 May 21 16:52
    segments.gen
    You have now confirmed that you are actually creating indexes.
    And
    the
    indexes you are creating exist at EXACTLY the place you have
    asked
    them
    to.
    Step 3: Then.. go download luke, and open these indexes.
    Perform

    a
    query
    on them, confirm that the data you want is actually IN the
    indexes.
    Step 4: Now, open up your standalone application, and replace
    whatever
    you
    are using in the to open the index with the SAME string I have
    listed
    above.
    Perform a search, verify that the indexes are there, and
    actually

    return
    values.
    Step 5: Lastly, go into your web application and again replace
    the
    path
    with the one I have above, recompile, and perform a search.
    Verify

    that
    the
    indexes are actually THERE and searchable.
    This.. damn well SHOULD work, if it doesn't it is likely
    pointing
    to
    some
    other issues in what you have setup. For example your tomcat

    instance
    could
    perhaps not have permission to read the lucene indexes directory.
    You
    should be able to tell this in the tomcat logs, BUT don't do
    this
    yet.
    Carefully and fully follow the steps I have outlined for you,
    and
    then
    you
    have chased down the full debugging path for this.
    If this yields nothing for you, I'd be happy to take a closer

    look
    at
    your
    source code, but until then give this a shot.
    Oh.. if it fails, please post back EXACTLY which steps in the

    above
    outlined process failed for you, as that will be really really
    helpful.
    Matt


    Marco Lazzara wrote:



    I dont't know hot to solve the problem..I've tried all
    rationals

    things.Maybe the last thing is to try to index not with
    FSDirectory

    but
    with
    something else.I have to peruse the api documentation.
    But.....IF IT WAS A LUCENE'S BUG???
    2009/5/22 Matthew Hall <mhall@informatics.jax.org>





    because that's the default index write behavior.

    It will create any directory that you ask it to.

    Matt


    Marco Lazzara wrote:





    ok.I understand what you really mean but It doesn't work.

    I understand one thing.For example When i try to open an
    index
    in

    the
    following location : "RDFIndexLucene/" but the folder
    doesn't
    exist,*Lucene
    create an empty folder named "RDFIndexLucene"* in my home
    folder...WHY???

    MARCO LAZZARA

    2009/5/22 Matthew Hall <mhall@informatics.jax.org>







    For writing indexes?

    Well I guess it depends on what you want.. but I
    personally

    use
    this:
    (2.3.2 API)

    File INDEX_DIR = "/data/searchtool/thisismyindexdirectory"
    Analyzer analyzer = new WhateverConcreteAnalyzerYouWant();

    writer = new IndexWriter(/INDEX_DIR/, /analyzer/, true);

    Your best bet would be to peruse the API docs of whatever
    lucene
    version
    you are using.

    However, I'm still pretty sure this ISN'T your actual
    issue

    here.
    Looking at your "full path" example those still seem to be by
    reference
    to
    me. Let me be more specific and tell you EXACTLY what I
    mean

    by
    that,
    Lets say you are running your program in the following

    directory:
    /home/test/app/
    Trying to open an index like you have below will
    effectively

    be
    trying
    to
    open an index in the following location:

    /home/test/app/home/marco/RdfIndexLucene

    What I think you MEAN to be doing is:

    /home/marco/RdfIndexLucene

    That leading slash is VERY VERY important, as its the
    entire
    difference
    between an relative path and an absolute one.

    Matt


    Marco Lazzara wrote:







    I was talking with my teacher.

    Is it correct to use FSDirectory?Could you please look
    again
    at

    the
    code
    I've posted here??
    Should I choose a different way to Indexing ??
    Marco Lazzara




    2009/5/22 Ian Lea <ian.lea@gmail.com>









    OK. I'd still like to see some evidence, but never
    mind.

    Next suggestion is the old standby - cut the code down
    to

    the
    absolute
    minimum to demonstrate the problem and post it here. I
    know
    you've
    already posted some code, but maybe not all of it, and
    definitely
    not
    cut down to the absolute minimum.
    --
    Ian.


    On Thu, May 21, 2009 at 10:48 PM, Marco Lazzara <
    marco.lazzara@gmail.com
    wrote:








    _I strongly suggest that you use a full path name
    and/or

    provide
    some
    evidence that your readers and writers are using the same
    directory
    and thus lucene index.
    _
    I try a full path like home/marco/RdfIndexLucene,even
    media/disk/users/fratelli/RDFIndexLucene.But nothing is

    changed.
    MARCOLAZZARA
    _
    _








    Its been a few days, and we haven't heard back about
    this

    issue,
    can
    we assume that you fixed it via using fully qualified
    paths
    then?
    Matt

    Ian Lea wrote:








    Marco

    You haven't answered Matt's question about where you
    are
    running
    it
    from. Tomcat's default directory may well not be the

    same
    as
    yours.
    I strongly suggest that you use a full path name and/or
    provide
    some
    evidence that your readers and writers are using the
    same
    directory
    and thus lucene index.

    --
    Ian.


    On Wed, May 20, 2009 at 9:59 AM, Marco Lazzara
    wrote:









    I've posted the indexing part,but I don't use this
    in

    my
    app.After
    I
    create the index,I put that in a folder like








    /home/marco/RDFIndexLucece




    and when I run the query I'm only searching (and not
    indexing).
    String[] fieldsearch = new String[] {"name",
    "synonyms",

    "propIn"};



    //RDFinder rdfind = new

    RDFinder("RDFIndexLucene/",fieldsearch);

    TreeMap<Integer, ArrayList<String>> paths;

    try {
    this.paths = this.rdfind.Search(text,

    "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara









    Sorry, anyhow looking over this quickly here's a

    summarization
    of








    what




    I see:

    You have documents in your index that look like the

    following:
    name which is indexed and stored.

    synonyms which are indexed and stored

    path, which is stored but not indexed
    propin, which is stored and indexed
    propinnum, which is stored but not indexed
    and ... vicinity I guess which is stored but not

    indexed
    For an analyzer you are using Standard analyzer
    (which
    considering








    all




    the Italian? is an interesting choice.)

    And you are opening your index using FSDirectory, in
    what

    appears
    to




    be a by reference fashion (You don't have a fully

    qualified
    path
    to

    where your index is, you are ASSUMING that its in
    the
    same
    directory
    as this code, unless FSDirectory is not implemented as
    I
    think
    ...
    [Messaggio troncato]
  • N. Hira at May 27, 2009 at 5:59 pm
    Thanks.

    Could you also post the code for RDFinder.Search() and the output
    from query.toString() when text is "PHILIPCIMIANO"?

    -h
    On 27-May-2009, at 12:40 PM, Marco Lazzara wrote:

    String[] fieldsearch = new String[] {"name", "synonyms", "propIn"};
    RDFinder rdfind = new RDFinder("/home/marco/
    testIndex",fieldsearch);
    try {
    this.paths = this.rdfind.Search(text, "path");
    } catch (ParseException e1) {
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    }

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>
    Okay -- that helps.

    So we know that searching the same files with Luke works, but with
    the web
    app does not. Can you please re-post the fragment of code that
    opens your
    index and uses the query?

    If you haven't already done this, could you also use query.toString
    () to
    confirm the query?

    Thanks.

    -h



    On 27-May-2009, at 12:14 PM, Marco Lazzara wrote:

    NO.the app creates the index in a folder and I run the query in
    that
    folder.
    For example if I decide to create the folder in /home/marco/
    testIndex
    ,obviously I run the query on /home/marco/testIndex
    if I decide to create the folder in /home/marco/
    RDFLUCENE ,obviously I run
    the query on /home/marco/RDFLUCENE
    But I ALWAYS obtain no results.


    In order to understand how tomcat works with lucene I made an
    experiment:
    I
    deleted all files in the index and I tried to run the query in
    the empty
    folder and It fails with:
    no segments* file found in org.apache.lucene.store

    It means that Lucene recognizes the index (when it isn't empty)
    but on the
    webapp It obtains no result

    Marco Lazzara


    2009/5/27 N. Hira <nhira@cognocys.com>

    Okay -- if the problem is not the number of results, then let's
    clarify
    the
    problem:

    1. You create an index in something like:
    /home/marco/testIndex

    2. You copy over the directory to something like:
    /home/marco/RDFIndexLucene

    3. When you run Tomcat, your "searcher" tries to open the index
    at 2.
    above (using the full path, including the leading slash) and
    fails with:
    no segments* file found in org.apache.lucene.store


    Could you please confirm that this is the problem you are trying to
    resolve? If no, then please correct what I have stated above.

    -h


    On 27-May-2009, at 11:22 AM, Marco Lazzara wrote:

    In my app I obtain 3 results.But I think is not a problem
    Marco Lazzara

    2009/5/27 Erick Erickson <erickerickson@gmail.com>

    StandardAnalyzer is fine. I loaded your index into Luke and
    there is
    exactly
    one document with philipcimiano in the name field.
    There is only one document that has researcher in the name field.
    Both of these documents (using StandardAnalyzer) return one
    document (doc 12 for PHILIPCIMIANO and doc 4 for RESEARCHER)
    as I would expect.

    So what is the behavior you expect?

    Best
    Erick

    On Wed, May 27, 2009 at 11:47 AM, Marco Lazzara <
    marco.lazzara@gmail.com

    wrote:
    I attache the file testIndex.zip.Run the query with :
    PHILIPCIMIANO,
    or
    RESEARCHER.

    I use StandardAnalyzer.Is it a problem?

    Marco Lazzara

    2009/5/27 N. Hira <nhira@cognocys.com>

    Not sure if this applies here, but that tends to happen when
    the
    analyzer
    you use for indexing is different from the one used in Luke
    or you're
    running into character set issues. Are you using the
    StandardAnalyzer

    in
    both cases?
    Also, could you post an example of the query you are
    trying? There
    are
    some very smart people who check this list and they may be
    able to
    help

    you
    if they had a "sample" of your index, i.e., create a 10-
    document index
    and
    make it available for download so people can look at it for you?
    -h

    On 27-May-2009, at 2:02 AM, Marco Lazzara wrote:

    * I see that you have reported the creation of 3 files, but
    does
    Luke

    recognize those files as an index and do you see the
    Documents you

    expect
    to
    see in this index?*
    Luke recognizes those files and I see those documents in
    this index
    but

    I
    observed that when I run the query Luke finds (for example)
    only 3
    files
    of
    5.
    Any ideas???
    Marco Lazzara


    2009/5/27 N Hira <nhira@cognocys.com>


    Sorry for the confusion -- I checked the archive and I
    could not
    find
    a
    message where you have been able to open the index using Luke.
    Have you been able to do that? I see that you have
    reported the
    creation
    of 3 files, but does Luke recognize those files as an
    index and do
    you
    see
    the Documents you expect to see in this index?

    This is the official site for Luke:
    http://www.getopt.org/luke/

    -h


    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.apache.org
    Sent: Tuesday, May 26, 2009 4:59:14 PM
    Subject: Re: Searching index problems with tomcat

    *Does the part of the web app that is responsible for
    searching
    have
    permissions to read "/home/marco/testIndex"?*

    Yes It does.It can read everywhere.

    *Could you add some code to your searching app to print
    out the
    directory
    listing to confirm?*

    I've already posted them.See May 19

    *Also, I may have missed this posting, but could you
    provide the

    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you find
    the data
    that
    you expected in your index using Luke?*


    yes.there are 3 files in the index.see May 24

    -rw-r--r-- 1 marco marco 4043 2009-05-24 12:00 _5.cfs
    -rw-r--r-- 1 marco marco 58 2009-05-24 12:00 segments_c
    -rw-r--r-- 1 marco marco 20 2009-05-24 12:00 segments.gen


    2009/5/26 N Hira <nhira@cognocys.com>


    Marco,
    Does the part of the web app that is responsible for
    searching
    have
    permissions to read "/home/marco/testIndex"?

    Could you add some code to your searching app to print
    out the
    directory
    listing to confirm?

    Also, I may have missed this posting, but could you
    provide the

    answer
    from
    Step 3. of mhall's suggestion on 22-May, i.e., did you
    find the
    data
    that
    you expected in your index using Luke?

    Good luck.

    -h



    ----- Original Message ----
    From: Marco Lazzara <marco.lazzara@gmail.com>
    To: java-user@lucene.