Lucene을 사용하여 IList를 인덱싱하는 지루한 문제가 있습니다. 또한Hibernate Search와 ILene의 Lucene 초기 인덱싱
[ScriptIgnore] //will not serialize
[IndexedEmbedded(Depth = 1, Prefix = "BookAdditionalInfos_"]
public virtual IList<BookAdditionalInfo> BookAdditionalInfos { get; set; }
, 인덱싱 필드 속성에 사용되는 몇 가지 다른 속성 : 인덱싱 엔티티를 표시 한 후
[Field(Index.Tokenized, Store = Store.Yes)]
, 내가해야
내 기업은이 같은 IndexedEmbedded 특성을 적용은 IList 포함 일괄 처리를 사용하여 12 백만 행의 초기 색인 생성 BookAdditionalInfos라는 IList를 색인하기 시작할 때까지 모든 것이 완벽하게 작동합니다. 이 IndexedEmbedded 속성이 없으면 (또는이 IList를 인덱싱하지 않으면) 모든 것이 정상이며 Field 속성이있는 모든 속성 표시가 인덱싱됩니다.
Fluent NHibernate를 사용하고 있습니다.
무엇이 문제입니까? 또한 내가 http://ayende.com/blog/3992/nhibernate-search 보았다, 그러나 어떤 결과
없이 문제는 다음과 같습니다 :
당신에게편집 감사 내가 색인 영원히 복용하고 아무것도 색인이되지 않습니다, 색인은 IList하려고 할 때. 이 IList를 인덱싱하지 않고 (또는 IList에 IndexedEmbedded을 지정하지 않고) 인덱싱은 정상적으로 수행되며 인덱싱 된 결과가 표시됩니다.
EDIT (초기 인덱싱 기능) : 당신이 거기에 고전 N + 1 개 선택 문제가 생겼어요처럼
public void BuildInitialBookSearchIndex()
{
FSDirectory directory = null;
IndexWriter writer = null;
var type = typeof(Book);
var info = new DirectoryInfo(GetIndexDirectory());
//if (info.Exists)
//{
// info.Delete(true);
//}
try
{
directory = FSDirectory.GetDirectory(Path.Combine(info.FullName, type.Name), true);
writer = new IndexWriter(directory, new StandardAnalyzer(), true);
}
finally
{
if (directory != null)
{
directory.Close();
}
if (writer != null)
{
writer.Close();
}
}
var fullTextSession = Search.CreateFullTextSession(Session);
var currentIndex = 0;
const int batchSize = 5000;
while (true)
{
var entities = Session
.CreateCriteria<Book>()
.SetFirstResult(currentIndex)
.SetMaxResults(batchSize)
.List();
using (var tx = Session.BeginTransaction())
{
foreach (var entity in entities)
{
fullTextSession.Index(entity);
}
currentIndex += batchSize;
Session.Flush();
tx.Commit();
Session.Clear();
}
if (entities.Count < batchSize)
break;
}
}
무엇이 문제입니까? 던져지는 예외가 있습니까? –
은 예외를 throw하지 않습니다. 위의 질문에 12 백만 행을 인덱싱하는 데 사용하는 초기 인덱싱 기능이 제공됩니다. IList가 IndexedEmbedded으로 표시 될 때이 함수에 몇 가지 문제가 있다고 생각합니다. – Koste
문제가 무엇을 의미하는지 혼란 스럽습니다. 아무런 예외도 던지지 않고 있습니다. 영원히 받아 들여지고 있습니까? 필드를 잘못 인덱싱합니까? – Prescott