1

Lucene に、サイトルートの外部でインデックス付けされた結果を含めるにはどうすればよいですか。fx のルートに基づくもの。"/sitecore/content/stuff" に配置されますが、"/sitecore/content/Home" には配置されません。

"/sitecore modules/LuceneSearch/" にある SearchManager.cs を見ると、SiteRoot は "SiteCore.Content.Site.Startpath" として定義されていますが、このファイルを変更しても影響はないようです。

注:
「LuceneResults」.ascx と .cs のみを使用しています。

----- 問題が何であるかを絞り込んだため、質問が更新されました -----

Lucene 検索で使用するために、特定のアイテム セットのインデックスを作成しようとしています。
web.config で、以下を含むインデックスを指定しました。

 ...
 <root>/sitecore/content/Home/Subfolder</root>
 ...

それは完璧に機能し、検索時にすべてのサブアイテムを取得します.

次に、まったく同じアイテムを新しい場所にコピーし、web.config を次のように更新しました。

 ...
 <root>/sitecore/content/newSubfolder/Subfolder/Subfolder</root>
 ...

今、私の検索では何も見つかりません!
ここで何が問題になるのか、誰にも分かりますか。

注:
- 変更のたびに検索インデックス データベースを再構築しました。
- "Luke" では、インデックスは問題ないようで、ここで検索すると適切な結果が得られます。

完全な索引:

<index id="faqindex" type="Sitecore.Search.Index, Sitecore.Kernel">
    <param desc="name">$(id)</param>
    <param desc="folder">__faq</param>
    <Analyzer ref="search/analyzer"/>
    <locations hint="list:AddCrawler">
        <resources type="Sitecore.Search.Crawlers.DatabaseCrawler, Sitecore.Kernel">
            <database>master</database>
                      <root>/sitecore/content/MyContent/Snippets/FAQ</root>
            <include hint="list:IncludeTemplate">
                <faqblock>{3340AAAE-B2F8-4E22-8B7B-F3EDDB48587E}</faqblock>
            </include>
            <tags>faqblock</tags>
            <boost>1.0</boost>
        </resources>
    </locations>
</index>
4

1 に答える 1

0

Sitecore MarketplaceのLucene 検索モジュールを使用しているようです。このモジュールのコードは、検索結果をサイト ルートとその子に制限します。

 public SearchManager(string indexName)
 {
   SearchIndexName = indexName;
   Database database = Factory.GetDatabase("master");
   var item = Sitecore.Context.Site.StartPath;
   SiteRoot = database.GetItem(item);
}
[...]
public SearchResultCollection Search(string searchString)
{
  //Getting index from the web.config
  var searchIndex = Sitecore.Search.SearchManager.GetIndex(SearchIndexName);
  using(IndexSearchContext context = searchIndex.CreateSearchContext())
  {
     SearchHits hits = context.Search(searchString, new SearchContext(SiteRoot));

sitecore modules\Lucene Search\SearchManager.cs

Web.config のサイトセクションの "website" ノードにstartItem="/home" があると仮定すると、"home" 階層外の結果は返されません。

このプロジェクトのソース コードをダウンロードし、SiteRoot を設定する行を次のように編集すると、新しいアイテムが返されます。

SiteRoote = database.GetItem("/sitecore/content");

新しい LuceneSearch.dll を Web サイト プロジェクトの bin ディレクトリに忘れずにコピーしてください。

于 2013-02-08T06:34:29.197 に答える