@Override public Analyzer createAnalyzer() { return new SimpleAnalyzer(); }
public SimpleAnalyzerProvider(IndexSettings indexSettings, Environment environment, String name, Settings settings) { super(indexSettings, name, settings); this.simpleAnalyzer = new SimpleAnalyzer(); this.simpleAnalyzer.setVersion(version); }
/** * Initialize the Lucene Directory if it isn't already. * * @param directory the Directory to initialize * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found */ public static void initializeIndexIfNeeded(Directory directory) { SimpleAnalyzer analyzer = new SimpleAnalyzer(); try { if ( ! DirectoryReader.indexExists( directory ) ) { try { IndexWriterConfig iwriterConfig = new IndexWriterConfig( analyzer ).setOpenMode( OpenMode.CREATE_OR_APPEND ); //Needs to have a timeout higher than zero to prevent race conditions over (network) RPCs //for distributed indexes (Infinispan but probably also NFS and similar) SleepingLockWrapper delayedDirectory = new SleepingLockWrapper( directory, 2000, 20 ); IndexWriter iw = new IndexWriter( delayedDirectory, iwriterConfig ); iw.close(); } catch (LockObtainFailedException lofe) { log.lockingFailureDuringInitialization( directory.toString() ); } } } catch (IOException e) { throw new SearchException( "Could not initialize index", e ); } finally { analyzer.close(); } }
/** * Initialize the Lucene Directory if it isn't already. * * @param directory the Directory to initialize * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found */ public static void initializeIndexIfNeeded(Directory directory) { SimpleAnalyzer analyzer = new SimpleAnalyzer(); try { if ( ! DirectoryReader.indexExists( directory ) ) { try { IndexWriterConfig iwriterConfig = new IndexWriterConfig( analyzer ).setOpenMode( OpenMode.CREATE_OR_APPEND ); //Needs to have a timeout higher than zero to prevent race conditions over (network) RPCs //for distributed indexes (Infinispan but probably also NFS and similar) SleepingLockWrapper delayedDirectory = new SleepingLockWrapper( directory, 2000, 20 ); IndexWriter iw = new IndexWriter( delayedDirectory, iwriterConfig ); iw.close(); } catch (LockObtainFailedException lofe) { log.lockingFailureDuringInitialization( directory.toString() ); } } } catch (IOException e) { throw new SearchException( "Could not initialize index", e ); } finally { analyzer.close(); } }
@Override public Analyzer newAnalyzer(final String args) { return new SimpleAnalyzer(); } @Override
public SimpleAnalyzerProvider(IndexSettings indexSettings, Environment environment, String name, Settings settings) { super(indexSettings, name, settings); this.simpleAnalyzer = new SimpleAnalyzer(); this.simpleAnalyzer.setVersion(version); }
@Override public Analyzer newAnalyzer(final JSONObject args) { return new SimpleAnalyzer(); } },
public SimpleAnalyzerProvider(IndexSettings indexSettings, Environment environment, String name, Settings settings) { super(indexSettings, name, settings); this.simpleAnalyzer = new SimpleAnalyzer(); this.simpleAnalyzer.setVersion(version); }
@Override protected Analyzer create(Version version) { Analyzer a = new SimpleAnalyzer(); a.setVersion(version.luceneVersion); return a; } },
public SimpleAnalyzerProvider(IndexSettings indexSettings, Environment environment, String name, Settings settings) { super(indexSettings, name, settings); this.simpleAnalyzer = new SimpleAnalyzer(); this.simpleAnalyzer.setVersion(version); }
public static IndexWriter createIndexWriter(Directory directory, boolean create, AnalyzerType analyzer, double RAMBufferSize) throws IOException { // set the analyzer according to the method params Analyzer tmpAnalyzer = null; if (analyzer == AnalyzerType.SimpleAnalyzer) tmpAnalyzer = new SimpleAnalyzer(); else if (analyzer == AnalyzerType.WhitespaceAnalyzer) tmpAnalyzer = new WhitespaceAnalyzer(); // The config IndexWriterConfig config = new IndexWriterConfig(tmpAnalyzer); if (create) config.setOpenMode(IndexWriterConfig.OpenMode.CREATE); // overwrite if it exists. else config.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); // create new if none is there, append otherwise. config.setRAMBufferSizeMB(RAMBufferSize); config.setCodec(new LireCustomCodec()); return new IndexWriter(directory, config); }
public static IndexWriter createIndexWriter(Directory directory, boolean create, AnalyzerType analyzer, double RAMBufferSize) throws IOException { // set the analyzer according to the method params Analyzer tmpAnalyzer = null; if (analyzer == AnalyzerType.SimpleAnalyzer) tmpAnalyzer = new SimpleAnalyzer(); else if (analyzer == AnalyzerType.WhitespaceAnalyzer) tmpAnalyzer = new WhitespaceAnalyzer(); // The config IndexWriterConfig config = new IndexWriterConfig(tmpAnalyzer); if (create) config.setOpenMode(IndexWriterConfig.OpenMode.CREATE); // overwrite if it exists. else config.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); // create new if none is there, append otherwise. config.setRAMBufferSizeMB(RAMBufferSize); config.setCodec(new LireCustomCodec()); return new IndexWriter(directory, config); }
tmpAnalyzer = new SimpleAnalyzer(); // LetterTokenizer with LowerCaseFilter else if (analyzer == AnalyzerType.WhitespaceAnalyzer) tmpAnalyzer = new WhitespaceAnalyzer(); // WhitespaceTokenizer
tmpAnalyzer = new SimpleAnalyzer(); // LetterTokenizer with LowerCaseFilter else if (analyzer == AnalyzerType.WhitespaceAnalyzer) tmpAnalyzer = new WhitespaceAnalyzer(); // WhitespaceTokenizer
@Override protected Analyzer build() { return new SimpleAnalyzer(); } },
@Override public Analyzer open(Assembler a, Resource root, Mode mode) { return new SimpleAnalyzer(); } }
@Override public Analyzer open(Assembler a, Resource root, Mode mode) { return new SimpleAnalyzer(); } }
Query query = MultiFieldQueryParser.parse("development", new String[]{"title", "subject"}, new SimpleAnalyzer());
Query query = MultiFieldQueryParser.parse(Version.LUCENE_30, new String[] {"harry potter","harry potter","harry potter"}, new String[] {"title","author","content"},new SimpleAnalyzer()); IndexSearcher searcher = new IndexSearcher(...); Hits hits = searcher.search(query);
public ShingleTokenizer(int size) { this.analyzer = new ShingleAnalyzerWrapper(new SimpleAnalyzer(), size); }