lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gudiseashok <gudise.as...@gmail.com>
Subject Re: New to Apache Lucene: Need help in querying data - text with wildCards
Date Mon, 10 Feb 2014 17:27:19 GMT
Hi Michael

Thank you very much for your response, before I am trying your solution
(writing my own analyzer) I am just using Standard Analyzer which is
available in the example in lucene documentation, please see here my code
which is writing to lucene,

[code]
   File indexDirFile = new File(this.indexDir);

        Directory dir = FSDirectory.open(indexDirFile);
        /**
         * Use by certain classes to match version compatibility across
releases of Lucene.
         * WARNING: When changing the version parameter that you supply to
components in Lucene,
         * do not simply change the version at search-time, but instead also
adjust your
         * indexing code to match, and re-index.
         */

        /**
         *
         */
        Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_46);

        /**
         * Holds all the configuration that is used to create an
IndexWriter.
         * Once IndexWriter has been created with this object, changes to
this
         * object will not affect the IndexWriter instance. For that, use
         * LiveIndexWriterConfig that is returned from
IndexWriter.getConfig().
         */
        IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_46,
analyzer);
       
        if((overrideOpenModeFlag && openModeFlag)|| create){
        	iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE);
        }else{
        	iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);	
        }
        
       
        this.writer = new IndexWriter(dir, iwc);
[code]


and my indexSearcher is ,

[code]

       IndexReader indexReader = null;
       IndexSearcher indexSearcher = null;
       try{
            File indexDirFile = new File(this.indexDir);
            Directory dir = FSDirectory.open(indexDirFile);
            indexReader  = DirectoryReader.open(dir);
            indexSearcher = new IndexSearcher(indexReader);
       }catch(IOException ioe){
           ioe.printStackTrace();
       }

       this.indexSearcher = indexSearcher;
    
[code]

please advice,






--
View this message in context: http://lucene.472066.n3.nabble.com/New-to-Apache-Lucene-Need-help-in-querying-data-text-with-wildCards-tp4116515p4116519.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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


Mime
View raw message