FAQ
Hello List,

Lucene 3.0.1
Windows Vista Premium Home Edition

I am currently attempting to configure my IndexFiles.java file. My intention is to add the following functionality to the code as I require input text to be further analyzed than what the default analyzer does.


IndexWriter writer = new IndexWriter(FSDirectory.open(INDEX_DIR),

new NGramTokenFilter(

new LowerCaseFilter(

new StandardFilter(

new StandardTokenizer

(Version.LUCENE_CURRENT, null)))), true,

IndexWriter.MaxFieldLength.LIMITED);

System.out.println("Indexing to directory '" +INDEX_DIR+ "'...");

indexDocs(writer, docDir);

System.out.println("Optimizing...");

writer.optimize();

writer.close();

Date end = new Date();

System.out.println(end.getTime() - start.getTime() + " total milliseconds");



My problem lies in the IndexWriter class and the number of analyzer's/tokenizer's I am permitted to pass as parameters and I find that this is slightly unclear from the javadocs. Are there any existing resources to solve this problem? or can someone help me out please.



Anything would be greatly appreciated.



Lews Mc

Glasgow Caledonian University is a registered Scottish charity, number SC021474

Winner: Times Higher Education's Widening Participation Initiative of the Year 2009 and Herald Society's Education Initiative of the Year 2009
http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html

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

Search Discussions

  • Ian Lea at Nov 25, 2010 at 1:46 pm
    The normal technique is to write your own analyzer. See
    http://wiki.apache.org/lucene-java/LuceneFAQ#How_do_I_write_my_own_Analyzer.3F.
    Then pass that to IndexWriter - and be sure to use the same analyzer
    when you are searching, unless you're doing clever things.

    --
    Ian.


    On Thu, Nov 25, 2010 at 12:37 PM, McGibbney, Lewis John
    wrote:
    Hello List,

    Lucene 3.0.1
    Windows Vista Premium Home Edition

    I am currently attempting to configure my IndexFiles.java file. My intention is to add the following functionality to the code as I require input text to be further analyzed than what the default analyzer does.


    IndexWriter writer = new IndexWriter(FSDirectory.open(INDEX_DIR),

    new NGramTokenFilter(

    new LowerCaseFilter(

    new StandardFilter(

    new StandardTokenizer

    (Version.LUCENE_CURRENT, null)))), true,

    IndexWriter.MaxFieldLength.LIMITED);

    System.out.println("Indexing to directory '" +INDEX_DIR+ "'...");

    indexDocs(writer, docDir);

    System.out.println("Optimizing...");

    writer.optimize();

    writer.close();

    Date end = new Date();

    System.out.println(end.getTime() - start.getTime() + " total milliseconds");



    My problem lies in the IndexWriter class and the number of analyzer's/tokenizer's I am permitted to pass as parameters and I find that this is slightly unclear from the javadocs. Are there any existing resources to solve this problem? or can someone help me out please.



    Anything would be greatly appreciated.



    Lews Mc

    Glasgow Caledonian University is a registered Scottish charity, number SC021474

    Winner: Times Higher Education's Widening Participation Initiative of the Year 2009 and Herald Society's Education Initiative of the Year 2009
    http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html

    ---------------------------------------------------------------------
    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
  • Jiandong yang at Nov 29, 2010 at 3:15 am
    hello, all, here comes my question:
    as far as I know, lucene now offer the feature that ones can search some
    doc while the index which contains that specific doc is modifying.
    for example(pseudocode) :

    while indexWriter(indexDir).add(docA) is doing, can indexReader(indexDir)
    offer the query function?

    after the add is done, should the reader be reopen?

    or someone show me a simple example, thx a lot!!!

    --
    祝一切顺利~

    Best Regards,

    杨建东

    =====================================================

    Jiandong Yang
    Mobile Phone:15921536660
    email: yangjiandong@snda.com
    Architect management office


    Shanghai shanda networking development Co., LTD

    Shanghai 201203, P. R. China

    =====================================================
  • Michael McCandless at Nov 29, 2010 at 10:04 am
    Please don't hijack threads; start a new thread instead.

    Mike

    2010/11/28 jiandong yang <jdyangchina@gmail.com>:
    hello, all, here comes my question:
    as far as I know, lucene now offer the feature that ones can search some
    doc while the index which contains that specific doc is modifying.
    for example(pseudocode) :

    while indexWriter(indexDir).add(docA) is doing, can indexReader(indexDir)
    offer the query function?

    after the add is done, should the reader be reopen?

    or someone show me a simple example, thx a lot!!!

    --
    祝一切顺利~

    Best Regards,

    杨建东

    =====================================================

    Jiandong Yang
    Mobile Phone:15921536660
    email: yangjiandong@snda.com
    Architect management office


    Shanghai shanda networking development Co., LTD

    Shanghai 201203, P. R. China

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedNov 25, '10 at 12:37p
activeNov 29, '10 at 10:04a
posts4
users4
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase