久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔
站長百科 | 數(shù)字化技能提升教程 數(shù)字化時(shí)代生存寶典
首頁
數(shù)字化百科
電子書
建站程序
開發(fā)
服務(wù)器
辦公軟件
開發(fā)教程
服務(wù)器教程
軟件使用教程
運(yùn)營教程
熱門電子書
WordPress教程
寶塔面板教程
CSS教程
Shopify教程
導(dǎo)航
程序頻道
推廣頻道
網(wǎng)賺頻道
人物頻道
網(wǎng)站程序
網(wǎng)頁制作
云計(jì)算
服務(wù)器
CMS
論壇
網(wǎng)店
虛擬主機(jī)
cPanel
網(wǎng)址導(dǎo)航
WIKI使用導(dǎo)航
WIKI首頁
最新資訊
網(wǎng)站程序
站長人物
頁面分類
使用幫助
編輯測(cè)試
創(chuàng)建條目
網(wǎng)站地圖
站長百科導(dǎo)航
站長百科
主機(jī)偵探
IDCtalk云說
跨境電商導(dǎo)航
WordPress啦
站長專題
網(wǎng)站推廣
網(wǎng)站程序
網(wǎng)站賺錢
虛擬主機(jī)
cPanel
網(wǎng)址導(dǎo)航專題
云計(jì)算
微博營銷
虛擬主機(jī)管理系統(tǒng)
開放平臺(tái)
WIKI程序與應(yīng)用
美國十大主機(jī)
編輯“
SPB-設(shè)計(jì)機(jī)制-全文檢索
”
人物百科
|
營銷百科
|
網(wǎng)賺百科
|
站長工具
|
網(wǎng)站程序
|
域名主機(jī)
|
互聯(lián)網(wǎng)公司
|
分類索引
跳轉(zhuǎn)至:
導(dǎo)航
、?
搜索
警告:
您沒有登錄。如果您做出任意編輯,您的IP地址將會(huì)公開可見。如果您
登錄
或
創(chuàng)建
一個(gè)賬戶,您的編輯將歸屬于您的用戶名,且將享受其他好處。
反垃圾檢查。
不要
加入這個(gè)!
<span style="text-align:center; border:1px solid #000; float:right; padding:6px;"><strong>導(dǎo)航:</strong> [[SpaceBuilde二次開發(fā)手冊(cè)|上一頁]]</span> <div style="clear:both;"></div> 全文檢索在SpaceBuilder中有兩個(gè)重要的作用: #所有模糊搜索都采用全文檢索實(shí)現(xiàn),減輕[[數(shù)據(jù)庫]]的負(fù)擔(dān); #實(shí)現(xiàn)信息的挖掘,例如:資訊的相關(guān)資訊,[[博客]]文章的相關(guān)文章; [[SpaceBuilder]]的全文檢索功能以Lucene.Net為核心。Lucene.Net是[[Apache]] Lucene的[[c#]]語言版本,Apache Lucene是一個(gè)開源的[[搜索引擎]],提供一組解讀,過濾,分析文件,編排和使用索引的[[API]],它的強(qiáng)大之處除了高效和簡(jiǎn)單外,最重要的是使使用者可以隨時(shí)根據(jù)自己需要擴(kuò)展其功能。 '''一、索引文件同步機(jī)制''' 由于Lucene只能操作索引文件,而索引文件必須保證與數(shù)據(jù)庫數(shù)據(jù)同步。如何保證Lucene中索引文件與數(shù)據(jù)庫保持同步是一個(gè)必須要解決的問題。 [[Image:Spacebuilder097.jpg]] '''SpaceBuilder采用如下方式進(jìn)行解決''': *建立spb_ItemsForIndex表,臨時(shí)保存需要更新到索引文件的數(shù)據(jù); *編寫相應(yīng)的ExtensionModules,當(dāng)對(duì)象發(fā)生變化時(shí)記錄到spb_ItemsForIndex表中; '''例如''',SpaceBuilder.LuceneSearch.PrepareForUserIndexModule: <pre> public class PrepareForUserIndexModule : IGlobalModule { #region IGlobalModule Members public void Init(GlobalEventManager gem, System.Xml.XmlNode node) { gem.AfterUserChange += new UserEventHandler(gem_PostUserUpdate); } #endregion void gem_PostUserUpdate(User user, GlobalEventArgs e) { if ((user != null) && (e.State == ObjectState.Create || e.State == ObjectState.Update || e.State == ObjectState.Delete)) { ItemForIndex item = new ItemForIndex(); item.ItemID = user.UserID; if (user.UserType == UserTypes.PersonUser) item.SearchType = FullTextSearchTypes.PersonUser; else if (user.UserType == UserTypes.CompanyUser) item.SearchType = FullTextSearchTypes.CompanyUser; item.DataAction = e.State; SearchDataProvider.Instance().CreateUpdateDeleteItemForIndex(item, DataProviderAction.Create); } } } </pre> 當(dāng)添加、修改、刪除用戶時(shí)將自動(dòng)記錄到spb_ItemsForIndex *編寫相應(yīng)的Task,使spb_ItemsForIndex數(shù)據(jù)定期更新到Lucene索引文件中: <pre> public class PersonUserIndexTask : ITask { /// <summary> /// 每次更新索引的最大數(shù)目 /// </summary> private int count = 1000; #region ITask Members public void Execute(System.Xml.XmlNode node) { XmlAttribute countNode = node.Attributes["count"]; if (countNode != null) { try { count = int.Parse(countNode.Value); } catch { count = 1000; } } SearchDataProvider dp = SearchDataProvider.Instance(); IList<ItemForIndex> itemsForIndex = dp.GetItemsForIndex(FullTextSearchTypes.PersonUser, count); IList<ItemForIndex> createItems = new List<ItemForIndex>(); IList<ItemForIndex> updateItems = new List<ItemForIndex>(); IList<ItemForIndex> deleteItems = new List<ItemForIndex>(); foreach (ItemForIndex item in itemsForIndex) { if (item.DataAction == ObjectState.Create) createItems.Add(item); else if (item.DataAction == ObjectState.Update) updateItems.Add(item); else if (item.DataAction == ObjectState.Delete) deleteItems.Add(item); } #region Insert IList<PersonUser> createUsers = new List<PersonUser>(); foreach (ItemForIndex item in createItems) { createUsers.Add((PersonUser)Users.GetUser(item.ItemID)); } if (PersonUserIndexServer.Insert(createUsers)) { dp.DeleteItemsForIndex(createItems); } else { foreach (ItemForIndex item in createItems) { item.DataAction = ObjectState.Update; } dp.UpdateItemsForIndex(createItems); } IList<PersonUser> updateUsers = new List<PersonUser>(); foreach (ItemForIndex item in updateItems) { updateUsers.Add((PersonUser)Users.GetUser(item.ItemID)); } if (PersonUserIndexServer.Update(updateUsers)) { dp.DeleteItemsForIndex(updateItems); } int[] deleteUids = new int[deleteItems.Count]; for (int i = 0; i < deleteItems.Count; i++) { deleteUids[i] = deleteItems[i].ItemID; } if (PersonUserIndexServer.Delete(deleteUids)) { dp.DeleteItemsForIndex(deleteItems); } } #endregion } </pre> '''二、使用全文檢索''' *索引文件格式 *索引文件配置 <pre> <LuceneSearch globalIndexDirectory="~/IndexFiles" mergeFactor="10" minMergeDocs="100" /> </pre> #globalIndexDirectory表示所有索引文件的根目錄,可以是虛擬路徑(~/IndexFiles/),也可以是物理路徑(e:\SpaceBuilderIndex\ 或者 \\[[192.168.0.1]]\SpaceBuilderIndex\)。 #)mergeFactor表示合并因子,這個(gè)參數(shù)決定了在 Lucene 的一個(gè)索引塊中可以存放多少文檔以及把磁盤上的索引塊合并成一個(gè)大的索引塊的頻率。比如,如果合并因子的值是 10,那么當(dāng)內(nèi)存中的文檔數(shù)達(dá)到 10 的時(shí)候所有的文檔都必須寫到磁盤上的一個(gè)新的索引塊中。并且,如果磁盤上的索引塊的隔數(shù)達(dá)到 10 的話,這 10 個(gè)索引塊會(huì)被合并成一個(gè)新的索引塊。這個(gè)參數(shù)的默認(rèn)值是 10,如果需要索引的文檔數(shù)非常多的話這個(gè)值將是非常不合適的。對(duì)批處理的索引來講,為這個(gè)參數(shù)賦一個(gè)比較大的值會(huì)得到比較好的索引效果。 #minMergeDocs表示最小合并文檔數(shù),這個(gè)參數(shù)也會(huì)影響索引的性能。它決定了[[內(nèi)存]]中的文檔數(shù)至少達(dá)到多少才能將它們寫回磁盤。這個(gè)參數(shù)的默認(rèn)值是,如果你有足夠的內(nèi)存,那么將這個(gè)值盡量設(shè)的比較大一些將會(huì)顯著的提高索引性能。 #索引文件格式目前SpaceBuilder內(nèi)置了兩部分索引文件:一部分是針對(duì)個(gè)人用戶的索引,另一部分是Post(包括:[[博客]]文章、圖片、文件、[[網(wǎng)摘]]、資訊等)。如果新加的應(yīng)用可以直接使用Post索引,則可以省去建立索引文件格式的工作量,只需確定好Post索引的對(duì)應(yīng)關(guān)系。否則,需要建立新加應(yīng)用的索引文件格式。 #開發(fā)新加應(yīng)用的ExtensionModules及Task; #開發(fā)新加應(yīng)用的FullTextQuery(查詢條件)及Search(查詢器);例如:SpaceBuilder.File.FileThreadFullTextQuery及SpaceBuilder.LuceneSearch.FileSearch。 ==參考資料== *[http://doc.spacebuilder.cn SpaceBuilder官方] [[category:SpaceBuilder|S]]
摘要:
請(qǐng)注意,您對(duì)站長百科的所有貢獻(xiàn)都可能被其他貢獻(xiàn)者編輯,修改或刪除。如果您不希望您的文字被任意修改和再散布,請(qǐng)不要提交。
您同時(shí)也要向我們保證您所提交的內(nèi)容是您自己所作,或得自一個(gè)不受版權(quán)保護(hù)或相似自由的來源(參閱
Wordpress-mediawiki:版權(quán)
的細(xì)節(jié))。
未經(jīng)許可,請(qǐng)勿提交受版權(quán)保護(hù)的作品!
取消
編輯幫助
(在新窗口中打開)
取自“
http://www.kktzf.com.cn/wiki/SPB-設(shè)計(jì)機(jī)制-全文檢索
”