コード例 #1
0
        public static List <SearchDoc> get_index_queue_items(Guid applicationId, int count, SearchDocType type)
        {
            List <SearchDoc> retList = new List <SearchDoc>();

            DataProvider.GetIndexQueueItems(applicationId, ref retList, count, type.ToString());
            return(retList);
        }
コード例 #2
0
        public static bool SetIndexLastUpdateDate(Guid applicationId, SearchDocType itemType, List <Guid> IDs)
        {
            string spName = GetFullyQualifiedName("SetIndexLastUpdateDate");

            try
            {
                return(ProviderUtil.succeed(ProviderUtil.execute_reader(spName, applicationId,
                                                                        itemType.ToString(), ProviderUtil.list_to_string <Guid>(ref IDs), ',', DateTime.Now)));
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SRCH);
                return(false);
            }
        }
コード例 #3
0
        public Document ToDocument(Guid applicationId)
        {
            try
            {
                Type         = PublicMethods.verify_string(Type);
                AdditionalID = PublicMethods.verify_string(AdditionalID);
                Title        = PublicMethods.verify_string(Title);
                Description  = PublicMethods.verify_string(Description);
                Tags         = PublicMethods.verify_string(Tags);
                Content      = PublicMethods.verify_string(Content);
                FileContent  = PublicMethods.verify_string(FileContent);

                Type = PublicMethods.verify_string(Type);
                Field f;
                Lucene.Net.Documents.Document postDocument = new Lucene.Net.Documents.Document();

                f = new Field("ID", ID.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED);
                postDocument.Add(f);

                f       = new Field("TypeID", TypeID.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED);
                f.Boost = BoostTypeID;
                postDocument.Add(f);

                if (!string.IsNullOrEmpty(Type))
                {
                    f = new Field("Type", Type, Field.Store.YES,
                                  Field.Index.NOT_ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
                    f.Boost = BoostType;
                    postDocument.Add(f);
                }

                if (!string.IsNullOrEmpty(AdditionalID))
                {
                    f = new Field("AdditionalID", AdditionalID,
                                  Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
                    f.Boost = BoostAdditinalID;
                    postDocument.Add(f);
                }

                if (!string.IsNullOrEmpty(Title))
                {
                    f = new Field("Title", Title,
                                  Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
                    f.Boost = BoostTitle;
                    postDocument.Add(f);
                }

                if (!string.IsNullOrEmpty(Description))
                {
                    f = new Field("Description", Description,
                                  Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
                    f.Boost = BoostDescription;
                    postDocument.Add(f);
                }

                if (!string.IsNullOrEmpty(Tags))
                {
                    f = new Field("Tags", Tags.ToString(),
                                  Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
                    f.Boost = BoostTags;
                    postDocument.Add(f);
                }

                f = new Field("Deleted", Deleted.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED);
                postDocument.Add(f);

                if (!string.IsNullOrEmpty(Content))
                {
                    f = new Field("Content", Content.ToString(),
                                  Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
                    f.Boost = BoostContent;
                    postDocument.Add(f);
                }

                if (!string.IsNullOrEmpty(FileContent))
                {
                    f = new Field("FileContent", FileContent.ToString(),
                                  Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
                    f.Boost = BoostFileContent;
                    postDocument.Add(f);
                }

                f = new Field("NoContent", NoContent.ToString().ToLower(),
                              Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
                f.Boost = BoostNoContent;
                postDocument.Add(f);

                f = new Field("SearchDocType", SearchDocType.ToString(), Field.Store.YES, Field.Index.ANALYZED,
                              Field.TermVector.WITH_POSITIONS_OFFSETS);
                f.Boost = BoostDocType;
                postDocument.Add(f);

                return(postDocument);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, "ConvertToLuceneDocument", ex, ModuleIdentifier.SRCH);
                return(null);
            }
        }