Examine normal query doesn't work, but raw query does...
So I'm doing something that looks to me as quite straightforward; finding a bunch of nodes that live under a specific root node:
var searcher = ExamineManager.Instance.SearchProviderCollection[Constants.Examine.InternalSearcher];
ISearchCriteria searchCriteria = searcher.CreateSearchCriteria();
// limit to defined root node ID
var filter = searchCriteria.Field("__Path", @"\-1," + rootNodeId.ToString().MultipleCharacterWildcard().Value);
// only search events
filter = filter.And().GroupedOr(new[] { "nodeTypeAlias" }, "myEvent");
var query = filter.Compile();
// search
var results = searcher.Search(query);
The above code gives me no results, even though there are nodes available.
However when I change the last two lines to this:
var query = filter.Compile() as LuceneSearchCriteria;
// create new query using the raw Lucene query string
var query2 = searcher.CreateSearchCriteria().RawQuery(query.Query.ToString());
// search
var results = searcher.Search(query2);
Examine normal query doesn't work, but raw query does...
So I'm doing something that looks to me as quite straightforward; finding a bunch of nodes that live under a specific root node:
The above code gives me no results, even though there are nodes available.
However when I change the last two lines to this:
And it now does return the correct results...
Does anyone know why that would be the case?
Normally when you have that situation, means that something is wrong with your query. In your case try to replace:
to
And it should work ;-)
Thanks for the reply.
Unfortunately I'm not able to test this, since it was over two years ago since I worked on this particular project :-)
Ahh, no prob, I just placed this comment here in case if any one else will have similar issue :)
Hi Tom, when using the fluent API as you have it, if I look at the resultant lucene query
I see
the negative seems to be stripped???
I'm querying the internalIndexer on an umb 8.1.2 site... Do you know why this is, and any work arounds?
Sorry, I haven't used Examine in v8 yet, so I don't know whether things might work differently there compared to v7.
is working on a reply...