I've read that Lucene can handle multiple fields with the same name in a document. I've even seen an example using Examine. However, I'm struggling to get it working in 7.14.
Take this simple code:
public static void CourseIndexer_DocumentWriting(object sender, Examine.LuceneEngine.DocumentWritingEventArgs e, UmbracoHelper umbHelper)
{
var practiceAreas = course.PracticeAreas;
foreach (var practiceArea in practiceAreas)
{
e.Document.Add(new Field("practiceArea", practiceArea, Field.Store.YES, Field.Index.NOT_ANALYZED));
}
}
This only ever adds a single field named "practiceArea". Am I doing something wrong here or is it a bug?
Thanks for your reply but it is actually possible to do. My code seems to work but I was testing it using the search in the Examine Management tool in the backoffice. In the search results it only seems to display a field once even though several fields with the same name exists, and are searchable. I think this can be classed as a bug.
Adding multiple fields with same name to index
Hi guys
I've read that Lucene can handle multiple fields with the same name in a document. I've even seen an example using Examine. However, I'm struggling to get it working in 7.14.
Take this simple code:
This only ever adds a single field named "practiceArea". Am I doing something wrong here or is it a bug?
Thanks
Hi Mitch,
You can do this as a space separated terms. You cant have multiple fields with the same name.
If you terms have spaces just make sure you query with And not or
Matt
Hi Matt
Thanks for your reply but it is actually possible to do. My code seems to work but I was testing it using the search in the Examine Management tool in the backoffice. In the search results it only seems to display a field once even though several fields with the same name exists, and are searchable. I think this can be classed as a bug.
is working on a reply...