public FilteringTokenFilter(Lucene.Net.Util.LuceneVersion version, bool enablePositionIncrements, TokenStream input) : this(version, input) { posIncrAtt = AddAttribute<IPositionIncrementAttribute>(); CheckPositionIncrement(version, enablePositionIncrements); this.enablePositionIncrements = enablePositionIncrements; }
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; }
public LuceneIndexingService( IPackageSource packageSource, Lucene.Net.Store.Directory directory) { _packageSource = packageSource; _directory = directory; }
public LuceneSearcher(Lucene.Net.Store.Directory luceneDirectory, Analyzer analyzer) : base(analyzer) { _disposer = new DisposableSearcher(this); LuceneIndexFolder = null; _luceneDirectory = luceneDirectory; }
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); }
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>(); }
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; }
public static SimpleDataIndexer GetSimpleIndexer(Lucene.Net.Store.Directory luceneDir) { var i = new SimpleDataIndexer(new IndexCriteria( new IIndexField[] { }, new[] { new TestIndexField { Name = "Author" }, new TestIndexField { Name = "DateCreated", EnableSorting = true, Type = "DateTime" }, new TestIndexField { Name = "Title" }, new TestIndexField { Name = "Photographer" }, new TestIndexField { Name = "YearCreated", Type = "Date.Year" }, new TestIndexField { Name = "MonthCreated", Type = "Date.Month" }, new TestIndexField { Name = "DayCreated", Type = "Date.Day" }, new TestIndexField { Name = "HourCreated", Type = "Date.Hour" }, new TestIndexField { Name = "MinuteCreated", Type = "Date.Minute" }, new TestIndexField { Name = "SomeNumber", Type = "Number" }, new TestIndexField { Name = "SomeFloat", Type = "Float" }, new TestIndexField { Name = "SomeDouble", Type = "Double" }, new TestIndexField { Name = "SomeLong", Type = "Long" } }, new string[] { }, new string[] { }, -1), luceneDir, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), new TestSimpleDataProvider(), new[] { "Documents", "Pictures" }, false); i.IndexingError += IndexingError; return i; }
private Index CreateIndexImplementation(string name, IndexDefinition indexDefinition, Lucene.Net.Store.Directory directory) { var viewGenerator = indexDefinitionStorage.GetViewGenerator(name); return indexDefinition.IsMapReduce ? (Index)new MapReduceIndex(directory, name, indexDefinition, viewGenerator) : new SimpleIndex(directory, name, indexDefinition, viewGenerator); }
public override void OnIndexEntryCreated(string entryKey, Lucene.Net.Documents.Document document) { lock (parent.DataTable) { parent.DataTable.Rows.Add(entryKey, document.GetField("Project").StringValue); } }
public SecureSearcherManager(string indexName, Lucene.Net.Store.Directory directory) : base(directory) { IndexName = indexName; RegistrationBaseAddress = new Dictionary<string, Uri>(); }
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; }
/// <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; }
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; }
public override List<SkinnyItem> RunQuery(Lucene.Net.Search.Query query, bool showAllVersions = false, string sortField = "", bool reverse = true, int start = 0, int end = 0) { using (var scope = QueryTraceHelper.GetQueryTraceScope(query)) { return base.RunQuery(query, showAllVersions, sortField, reverse, start, end); } }
public static UmbracoContentIndexer GetUmbracoIndexer( Lucene.Net.Store.Directory luceneDir, Analyzer analyzer = null, IDataService dataService = null) { if (dataService == null) { dataService = new TestDataService(); } if (analyzer == null) { analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29); } var indexSet = new IndexSet(); var indexCriteria = indexSet.ToIndexCriteria(dataService, UmbracoContentIndexer.IndexFieldPolicies); var i = new UmbracoContentIndexer(indexCriteria, luceneDir, //custom lucene directory dataService, analyzer, false); //i.IndexSecondsInterval = 1; i.IndexingError += IndexingError; return i; }
protected override void AddAllFields(Lucene.Net.Documents.Document document, Data.Items.Item item, bool versionSpecific) { base.AddAllFields(document, item, versionSpecific); if (item != null && document != null) { #if SC70 var fieldAnalysis = Field.Index.ANALYZED; #else var fieldAnalysis = Field.Index.TOKENIZED; #endif // Sitecore 6.2 does not include template document.Add(new Field(Constants.Index.Fields.Template, TransformValue(item.TemplateID), Field.Store.NO, fieldAnalysis)); // Add multilist fields foreach (var fieldName in m_multilistFields) { if(item.Fields[fieldName] != null) document.Add(new Field(fieldName, TransformMultilistValue(item.Fields[fieldName]), Field.Store.YES, fieldAnalysis)); } // Add additional fields foreach (var fieldName in m_dataFieldNames) { if (item.Fields[fieldName] != null) { document.Add(new Field(fieldName, TransformCSV(item.Fields[fieldName].Value), Field.Store.YES, fieldAnalysis)); } } // Add modified language code to deal with dash in region specific languages document.Add(new Field(Constants.Index.Fields.Language, TransformLanguageCode(item.Language.Name), Field.Store.NO, fieldAnalysis)); } }
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; }
/// <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; }
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); } }
private void InitBlock(int num, Lucene.Net.Index.IndexWriter writer, Lucene.Net.Store.MockRAMDirectory ramDir, TestRAMDirectory enclosingInstance) { this.num = num; this.writer = writer; this.ramDir = ramDir; this.enclosingInstance = enclosingInstance; }
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; }
private void InitBlock(long endTime, Lucene.Net.Index.IndexWriter writer, Lucene.Net.Store.Directory[] dirs, System.Collections.IList excs, TestIndexWriterReader enclosingInstance) { this.endTime = endTime; this.writer = writer; this.dirs = dirs; this.excs = excs; this.enclosingInstance = enclosingInstance; }
private void InitBlock(Lucene.Net.Index.IndexReader reader, Lucene.Net.Index.TermEnum enumerator, System.String field, AnonymousClassSortComparatorSource enclosingInstance) { this.reader = reader; this.enumerator = enumerator; this.field = field; this.enclosingInstance = enclosingInstance; cachedValues = Enclosing_Instance.FillCache(reader, enumerator, field); }
/// <summary> /// Initializes a new instance of the <see cref="LuceneSearcher"/> class. /// </summary> /// <param name="query">The query.</param> /// <param name="indexName">Name of the index.</param> public LuceneSearcher(Lucene.Net.Search.Query query, string indexName) { Assert.ArgumentNotNull(query, "query"); Assert.ArgumentNotNullOrEmpty(indexName, "indexName"); this.query = query; this.indexName = indexName; }
public Dictionary<string, int> GetSearch(Lucene.Net.Search.Query query, List<string> filter, List<Util.SearchStringModel> searchQuery, string locationFilter, System.Collections.BitArray baseQuery) { using (var searcher = new IndexSearcher(ItemBucket.Kernel.Util.Constants.Index.Name)) { var results = searcher.RunFacet(query, false, false, 0, 0, "dimensions", filter, baseQuery, locationFilter); return results; } }
private void InitBlock(System.Random random, float percentDocs, Lucene.Net.Index.RepeatingTokenStream ts, int maxTF, TestTermdocPerf enclosingInstance) { this.random = random; this.percentDocs = percentDocs; this.ts = ts; this.maxTF = maxTF; this.enclosingInstance = enclosingInstance; }
public PDFIndexer(Lucene.Net.Store.Directory luceneDirectory, IDataService dataService, Analyzer analyzer, bool async) : base( new IndexCriteria(Enumerable.Empty<IIndexField>(), Enumerable.Empty<IIndexField>(), Enumerable.Empty<string>(), Enumerable.Empty<string>(), null), luceneDirectory, dataService, analyzer, async) { SupportedExtensions = new[] { ".pdf" }; UmbracoFileProperty = "umbracoFile"; }
public static UmbracoExamineSearcher GetUmbracoSearcher(Lucene.Net.Store.Directory luceneDir, Analyzer analyzer = null) { if (analyzer == null) { analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29); } return new UmbracoExamineSearcher(luceneDir, analyzer); }
private void InitBlock(int numDocs, System.String field, Lucene.Net.Index.TestPayloads.ByteArrayPool pool, Lucene.Net.Index.IndexWriter writer, TestPayloads enclosingInstance) { this.numDocs = numDocs; this.field = field; this.pool = pool; this.writer = writer; this.enclosingInstance = enclosingInstance; }
public void GenerateSearchIndex() { DB_HotelHelper hotel = new DB_HotelHelper(); var hoteDescriptions = hotel.GetHotelDescription(); Lucene.AddUpdateLuceneIndex(hoteDescriptions); //var h = Lucene.GetAllIndexRecords(); }
public QueryForm(Lucene <News> client) { InitializeComponent(); this.client = client; }
public IList <HotelDescriptionDTO> GetHotelDescriptions() { return(Lucene.GetAllIndexRecords().ToList()); }