use of org.apache.lucene.analysis.standard.StandardAnalyzer in project geode by apache.
the class PartitionedRepositoryManagerJUnitTest method createIndexAndRepoManager.
protected void createIndexAndRepoManager() {
fileAndChunkRegion = Mockito.mock(PartitionedRegion.class);
fileDataStore = Mockito.mock(PartitionedRegionDataStore.class);
when(fileAndChunkRegion.getDataStore()).thenReturn(fileDataStore);
when(fileAndChunkRegion.getTotalNumberOfBuckets()).thenReturn(113);
when(fileAndChunkRegion.getFullPath()).thenReturn("FileRegion");
indexStats = Mockito.mock(LuceneIndexStats.class);
fileSystemStats = Mockito.mock(FileSystemStats.class);
indexForPR = Mockito.mock(LuceneIndexForPartitionedRegion.class);
when(((LuceneIndexForPartitionedRegion) indexForPR).getFileAndChunkRegion()).thenReturn(fileAndChunkRegion);
when(((LuceneIndexForPartitionedRegion) indexForPR).getFileSystemStats()).thenReturn(fileSystemStats);
when(indexForPR.getIndexStats()).thenReturn(indexStats);
when(indexForPR.getAnalyzer()).thenReturn(new StandardAnalyzer());
when(indexForPR.getCache()).thenReturn(cache);
when(indexForPR.getRegionPath()).thenReturn("/testRegion");
repoManager = new PartitionedRepositoryManager(indexForPR, serializer);
repoManager.setUserRegionForRepositoryManager();
repoManager.allowRepositoryComputation();
}
use of org.apache.lucene.analysis.standard.StandardAnalyzer in project geode by apache.
the class RawLuceneRepositoryManagerJUnitTest method createIndexAndRepoManager.
protected void createIndexAndRepoManager() {
LuceneServiceImpl.luceneIndexFactory = new LuceneRawIndexFactory();
indexStats = Mockito.mock(LuceneIndexStats.class);
indexForPR = Mockito.mock(LuceneRawIndex.class);
when(indexForPR.getIndexStats()).thenReturn(indexStats);
when(indexForPR.getAnalyzer()).thenReturn(new StandardAnalyzer());
when(indexForPR.getCache()).thenReturn(cache);
when(indexForPR.getRegionPath()).thenReturn("/testRegion");
when(indexForPR.withPersistence()).thenReturn(true);
repoManager = new RawLuceneRepositoryManager(indexForPR, serializer);
repoManager.setUserRegionForRepositoryManager();
repoManager.allowRepositoryComputation();
}
use of org.apache.lucene.analysis.standard.StandardAnalyzer in project geode by apache.
the class LuceneIndexCommandsDUnitTest method createIndex.
private void createIndex(final VM vm1) {
vm1.invoke(() -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
Map<String, Analyzer> fieldAnalyzers = new HashMap();
fieldAnalyzers.put("field1", new StandardAnalyzer());
fieldAnalyzers.put("field2", new KeywordAnalyzer());
fieldAnalyzers.put("field3", null);
luceneService.createIndexFactory().setFields(fieldAnalyzers).create(INDEX_NAME, REGION_NAME);
createRegion();
});
}
use of org.apache.lucene.analysis.standard.StandardAnalyzer in project jackrabbit by apache.
the class IndexMigrationTest method testMigration.
public void testMigration() throws Exception {
List<Document> docs = new ArrayList<Document>();
docs.add(createDocument("ab", "a"));
docs.add(createDocument("a", "b"));
docs.add(createDocument("abcd", "c"));
docs.add(createDocument("abc", "d"));
DirectoryManager dirMgr = new RAMDirectoryManager();
PersistentIndex idx = new PersistentIndex("index", new StandardAnalyzer(Version.LUCENE_36), Similarity.getDefault(), new DocNumberCache(100), new IndexingQueue(new IndexingQueueStore(new RAMDirectory())), dirMgr, 0);
idx.addDocuments(docs.toArray(new Document[docs.size()]));
idx.commit();
IndexMigration.migrate(idx, dirMgr, SEP_CHAR);
}
use of org.apache.lucene.analysis.standard.StandardAnalyzer in project lucene-solr by apache.
the class SimpleQQParser method parse.
/* (non-Javadoc)
* @see org.apache.lucene.benchmark.quality.QualityQueryParser#parse(org.apache.lucene.benchmark.quality.QualityQuery)
*/
@Override
public Query parse(QualityQuery qq) throws ParseException {
QueryParser qp = queryParser.get();
if (qp == null) {
qp = new QueryParser(indexField, new StandardAnalyzer());
queryParser.set(qp);
}
BooleanQuery.Builder bq = new BooleanQuery.Builder();
for (int i = 0; i < qqNames.length; i++) bq.add(qp.parse(QueryParserBase.escape(qq.getValue(qqNames[i]))), BooleanClause.Occur.SHOULD);
return bq.build();
}
Aggregations