if (!examineManager.TryGetIndex("ExternalIndex", out var index))
{
// ...
}
var searcher = index.Searcher;
var query = searcher.CreateQuery("content");
var currentCulture = CurrentThread.CurrentCulture.Name.ToLower();
var searchFields = "pagetitle_{0},[...]";
var terms = query.GroupedOr(string.Format(searchFields, currentCulture).Split(','), searchTerm);
terms.Execute();
Please note that the External Index only contains nodes that are published to all languages. There is some reasoning behind this that I don't fully follow. And it can probably be remedied by configuring the indexer.
I believe so, using GroupedOr or GroupedAnd. But the documentation is spotty (to say the least), so I recommend some exploring. Examine is a third-party (nominally, at least) search library on top of Lucene, so usually a combination of Umbraco docs + Examine docs + Lucene docs is necessary.
Searching for ExternalIndex result
Hello,
I was wondering if there is a way to search for the ExternalIndex result when implementing a search function.
When I implement search I just get the fields of the results instead.
This is not only possible, but pretty standard.
Please note that the External Index only contains nodes that are published to all languages. There is some reasoning behind this that I don't fully follow. And it can probably be remedied by configuring the indexer.
Thanks a lot for the answer!
I had one other question if you wouldn't mind. Is there a way to implement a XOR query with Examine or is it only possible through raw Lucene?
I believe so, using
GroupedOr
orGroupedAnd
. But the documentation is spotty (to say the least), so I recommend some exploring. Examine is a third-party (nominally, at least) search library on top of Lucene, so usually a combination of Umbraco docs + Examine docs + Lucene docs is necessary.That worked like a charm! The documentation was a bit spotty but with some testing it did the job. Thank you so much!
is working on a reply...