本文整理汇总了C#中Lucene类的典型用法代码示例。如果您正苦于以下问题:C# Lucene类的具体用法?C# Lucene怎么用?C# Lucene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Lucene类属于命名空间,在下文中一共展示了Lucene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LuceneSearcher
public LuceneSearcher(Lucene.Net.Store.Directory luceneDirectory, Analyzer analyzer)
: base(analyzer)
{
_disposer = new DisposableSearcher(this);
LuceneIndexFolder = null;
_luceneDirectory = luceneDirectory;
}
示例2: Filter
public List<FacetReturn> Filter(Lucene.Net.Search.Query query, List<Util.SearchStringModel> searchQuery, string locationFilter, System.Collections.BitArray baseQuery)
{
if (InAvailableLocations(locationFilter))
{
var stopWatch = new Stopwatch();
if (Config.EnableBucketDebug || Sitecore.ItemBucket.Kernel.Util.Constants.EnableTemporaryBucketDebug)
{
Diagnostics.Log.Info("Start Extension Facet took : " + stopWatch.ElapsedMilliseconds + "ms",
this);
}
stopWatch.Start();
var returnFacets = this.GetSearch(query, GetFileExtensionsFromIndex().ToList(), searchQuery, locationFilter, baseQuery).Select(
facet =>
new FacetReturn
{
KeyName = facet.Key,
Value = facet.Value.ToString(),
Type = "extension",
ID = facet.Key
});
if (Config.EnableBucketDebug || Sitecore.ItemBucket.Kernel.Util.Constants.EnableTemporaryBucketDebug)
{
stopWatch.Stop();
Diagnostics.Log.Info("End Extension Facet took : " + stopWatch.ElapsedMilliseconds + "ms",
this);
}
return returnFacets.ToList();
}
return new List<FacetReturn>();
}
示例3: AzureDirectory
/// <summary>
/// Create an AzureDirectory
/// </summary>
/// <param name="storageAccount">storage account to use</param>
/// <param name="containerName">name of container (folder in blob storage)</param>
/// <param name="cacheDirectory">local Directory object to use for local cache</param>
/// <param name="rootFolder">path of the root folder inside the container</param>
public AzureDirectory(
CloudStorageAccount storageAccount,
string containerName = null,
Lucene.Net.Store.Directory cacheDirectory = null,
bool compressBlobs = false,
string rootFolder = null)
{
if (storageAccount == null)
throw new ArgumentNullException("storageAccount");
if (string.IsNullOrEmpty(containerName))
_containerName = "lucene";
else
_containerName = containerName.ToLower();
if (string.IsNullOrEmpty(rootFolder))
_rootFolder = string.Empty;
else
{
rootFolder = rootFolder.Trim('/');
_rootFolder = rootFolder + "/";
}
_blobClient = storageAccount.CreateCloudBlobClient();
_initCacheDirectory(cacheDirectory);
this.CompressBlobs = compressBlobs;
}
示例4: FilteringTokenFilter
public FilteringTokenFilter(Lucene.Net.Util.LuceneVersion version, bool enablePositionIncrements, TokenStream input)
: this(version, input)
{
posIncrAtt = AddAttribute<IPositionIncrementAttribute>();
CheckPositionIncrement(version, enablePositionIncrements);
this.enablePositionIncrements = enablePositionIncrements;
}
示例5: InitBlock
private void InitBlock(Lucene.Net.Index.IndexReader reader, SpanNotQuery enclosingInstance)
{
this.reader = reader;
this.enclosingInstance = enclosingInstance;
includeSpans = Enclosing_Instance.include.GetSpans(reader);
excludeSpans = Enclosing_Instance.exclude.GetSpans(reader);
}
示例6: SecureSearcherManager
public SecureSearcherManager(string indexName, Lucene.Net.Store.Directory directory)
: base(directory)
{
IndexName = indexName;
RegistrationBaseAddress = new Dictionary<string, Uri>();
}
示例7: LuceneIndexingService
public LuceneIndexingService(
IPackageSource packageSource,
Lucene.Net.Store.Directory directory)
{
_packageSource = packageSource;
_directory = directory;
}
示例8: FilterQueryByClasses
public static Lucene.Net.Search.Query FilterQueryByClasses(ISet<System.Type> classesAndSubclasses, Lucene.Net.Search.Query luceneQuery)
{
// A query filter is more practical than a manual class filtering post query (esp on scrollable resultsets)
// it also probably minimise the memory footprint
if (classesAndSubclasses == null)
{
return luceneQuery;
}
BooleanQuery classFilter = new BooleanQuery();
// annihilate the scoring impact of DocumentBuilder.CLASS_FIELDNAME
classFilter.SetBoost(0);
foreach (System.Type clazz in classesAndSubclasses)
{
Term t = new Term(DocumentBuilder.CLASS_FIELDNAME, TypeHelper.LuceneTypeName(clazz));
TermQuery termQuery = new TermQuery(t);
classFilter.Add(termQuery, BooleanClause.Occur.SHOULD);
}
BooleanQuery filteredQuery = new BooleanQuery();
filteredQuery.Add(luceneQuery, BooleanClause.Occur.MUST);
filteredQuery.Add(classFilter, BooleanClause.Occur.MUST);
return filteredQuery;
}
示例9: DocIdSetAnonymousInnerClassHelper
public DocIdSetAnonymousInnerClassHelper(QueryWrapperFilter outerInstance, Bits acceptDocs, AtomicReaderContext privateContext, Lucene.Net.Search.Weight weight)
{
this.OuterInstance = outerInstance;
this.AcceptDocs = acceptDocs;
this.PrivateContext = privateContext;
this.Weight = weight;
}
示例10: InitBlock
private void InitBlock(Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter enclosingInstance)
{
this.fcsi = fcsi;
this.inclusiveLowerPoint = inclusiveLowerPoint;
this.inclusiveUpperPoint = inclusiveUpperPoint;
this.enclosingInstance = enclosingInstance;
}
示例11: InitBlock
private void InitBlock(Lucene.Net.Index.IndexWriter writerFinal, int iFinal, int iterFinal, TestThreadedOptimize enclosingInstance)
{
this.writerFinal = writerFinal;
this.iFinal = iFinal;
this.iterFinal = iterFinal;
this.enclosingInstance = enclosingInstance;
}
示例12: Decorate
/// <summary>
/// Decorates the specified query adding context information.
/// </summary>
/// <param name="query">The source query.</param>
/// <returns>The decorated query.</returns>
public Lucene.Net.Search.Query Decorate(Lucene.Net.Search.Query query)
{
BooleanQuery result = new BooleanQuery(true);
result.Add(query, Occur.MUST);
this.AddDecorations(result);
return result;
}
示例13: RunQuery
public override List<SkinnyItem> RunQuery(Lucene.Net.Search.Query query, bool showAllVersions, string sortField, bool reverse, int start, int end, out int totalResults)
{
using (var scope = QueryTraceHelper.GetQueryTraceScope(query))
{
return base.RunQuery(query, showAllVersions, sortField, reverse, start, end, out totalResults);
}
}
示例14: MultiIndexLockFactory
public MultiIndexLockFactory(Lucene.Net.Store.Directory master, Lucene.Net.Store.Directory child)
{
if (master == null) throw new ArgumentNullException("master");
if (child == null) throw new ArgumentNullException("child");
_master = master;
_child = child;
}
示例15: InitBlock
private void InitBlock(System.Collections.BitArray bits, int[] totalHits, Lucene.Net.Search.FieldSortedHitQueue hq, IndexSearcher enclosingInstance)
{
this.bits = bits;
this.totalHits = totalHits;
this.hq = hq;
this.enclosingInstance = enclosingInstance;
}