A keyword is not tokenized, that's why you wont be able to search over a part of it. You'd rather use a Text fied.
About creating a special field : .... IndexWriter Ir = .... .... File f = .... Document doc = new Document(); if (f.toString.startsWith("C:\tomcat\webapps\Root\Group1") { doc.add(Field.Text("group", "Group1")); } if (f.toString.startsWith("C:\tomcat\webapps\Root\Group2") { doc.add(Field.Text("group", "Group2")); } doc.add(Field.Text("content", getContent(f))); Ir.addDocument(doc); .... Then you can search in group1 with query like that : group:Group1 AND rest_of_the_query. -----Message d'origine----- De : mahaveer jain [mailto:[EMAIL PROTECTED] Envoyé : mardi 14 septembre 2004 18:03 À : Lucene Users List Objet : RE: Help for text based indexing Well in my case the path is KeyWord. I had tried that earlier and it does not seems to work in a single index file. Can you explain a bit more about adding group1 and group2 ? Cocula Remi <[EMAIL PROTECTED]> wrote: Well you could add a field to each of your Documents whose value would be either "group1" or "group2". Or you could use the path to your files ... -----Message d'origine----- De : mahaveer jain [mailto:[EMAIL PROTECTED] Envoyé : mardi 14 septembre 2004 17:49 À : [EMAIL PROTECTED] Objet : RE: Help for text based indexing I am clear with looping recursively to index all the file under Root folder. But the problem is if I want to search only in group1 or group2.Is that possible to search only in one of the group folder ? Cocula Remi wrote: You just have to loop recurssively over the C:\tomcat\webapps\Root tree to create your index. Yes you can index databases; you will just have to write a mechanism that is able to create org.apache.lucene.document.Document from database. For instance : - connect JDBC - run a query for obtaining a ResultSet - loop for each row of that ResultSet : Create a new org.apache.lucene.document.Document from ResultSet data and add this document to the Index. end loop. For incremental indexing, I suppose you have to store some timestamp field in your index; but it's up to you. Note that Lucene is very fast and I don't think that incremetal indexing is required for small or medium amout of data. -----Message d'origine----- De : mahaveer jain [mailto:[EMAIL PROTECTED] Envoyé : mardi 14 septembre 2004 17:22 À : [EMAIL PROTECTED] Objet : Help for text based indexing Hi I have implemented Text based search using lucene. I was wonderful playing around with it. Now I want to enchance the application. I have a Root folder, under that I have many other folder, that are group specific, say (group1, group2, .. so on). The Root folder is in C:\tomcat\webapps\Root and group folder within that. Now I am index for these groups separately, ie , I have index as C:/index/group1, C:/index/group2, C:/index/group3 and so on I want to know if I can have only one index for all these say C:/index/Root (this has index for all the folder) and I should be able to Search using C:\tomcat\webapps\Root\group1(if want to search for group1) similarly for the other groups. Let me know if this is possible and have anybody tried this. 2nd question Is lucene good to index databases ? How do we support incremental indexing ? (Right now I am using LIKE for searching ) Thanks in Advance Mahaveer --------------------------------- Do you Yahoo!? vote.yahoo.com - Register online to vote today! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------- Do you Yahoo!? vote.yahoo.com - Register online to vote today! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------- Do you Yahoo!? vote.yahoo.com - Register online to vote today! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]