Exemple #1
0
        /// <summary>
        /// Deletes the matching objects in the IndexWriter.
        /// </summary>
        /// <param name="data"></param>
        public void Delete(IIndexableItem data)
        {
            Requires.NotNull(data);

            var   selection   = new TermQuery(new Term(JsonMappingUtils.FIELD_ID, data.GetId()));
            Query deleteQuery = new FilteredQuery(selection, JsonMappingUtils.GetTypeFilter(data.GetScope()));

            Store.Delete(deleteQuery);
        }
        /// <summary>
        /// Deletes the matching objects in the IndexWriter.
        /// </summary>
        /// <param name="data"></param>
        public void Delete(IIndexableItem data)
        {
            if (null == data)
            {
                throw new ArgumentNullException("data");
            }
            var   selection   = new TermQuery(new Term(JsonMappingUtils.FieldId, data.GetId()));
            Query deleteQuery = new FilteredQuery(selection, JsonMappingUtils.GetTypeFilter(data.GetScope()));

            Store.Delete(deleteQuery);
        }
 public static TopDocs Search(this Searcher searcher, string type, Query query, Query filter, int numResults, Sort sort)
 {
     try
     {
         return(searcher.Search(query, JsonMappingUtils.GetTypeFilter(type, filter), numResults, sort));
     }
     catch (Exception ex)
     {
         Log.Logger.ErrorFormat("Error while searching {0}, {1}", type, query.ToString());
         throw ex;
     }
 }
Exemple #4
0
 public static TopDocs Search(Searcher searcher, string type, Query query, Query filter, int numResults, Sort sort)
 {
     try
     {
         return(searcher.Search(query, JsonMappingUtils.GetTypeFilter(type, filter), numResults, sort));
     }
     catch (Exception ex)
     {
         App.Services.Logger.Error($"Error while searching {type}, {query}", ex);
         throw;
     }
 }
        /// <summary>
        /// Deletes the matching objects in the IndexWriter.
        /// </summary>
        /// <param name="data"></param>
        public void Delete(OpenContentInfo data)
        {
            if (null == data)
            {
                throw new ArgumentNullException("data");
            }

            var selection = new TermQuery(new Term(JsonMappingUtils.FieldId, data.ContentId.ToString()));

            Query deleteQuery = new FilteredQuery(selection, JsonMappingUtils.GetTypeFilter(data.ModuleId.ToString()));

            Store.Delete(deleteQuery);
        }
 /// <summary>
 /// Searches for documents mapped from the given type using the specified query and Collector.
 /// </summary>
 /// <param name="searcher">
 /// The Searcher to search on.
 /// </param>
 /// <param name="type">
 /// The type of the object to search documents for.
 /// </param>
 /// <param name="query">
 /// The Query which selects the documents.
 /// </param>
 /// <param name="results">
 /// The Collector to use to gather results.
 /// </param>
 public static void Search(this Searcher searcher, string type, Query query, Collector results)
 {
     searcher.Search(query, JsonMappingUtils.GetTypeFilter(type), results);
 }
        public static TopDocs Search(this Searcher searcher, string type, Query query, int numResults, Sort sort)
        {
            var res = searcher.Search(query, JsonMappingUtils.GetTypeFilter(type), numResults, sort);

            return(res);
        }
        public static TopDocs Search(this Searcher searcher, string type, Query Filter, Query query, int numResults)
        {
            Filter filter = new QueryWrapperFilter(query);

            return(searcher.Search(query, JsonMappingUtils.GetTypeFilter(type, Filter), numResults));
        }
 public static TopDocs Search(this Searcher searcher, string type, Query query, int numResults)
 {
     return(searcher.Search(query, JsonMappingUtils.GetTypeFilter(type), numResults));
 }