Examine, cannot search with parentID, why?

When searching in the ExternalIndex under Settings > Examine Management I’m not able to use ParentID as a parameter (ParentID:1242). I get 0 results.

But everything is fine when I use id or templateID like this: id:1242 or templateID:1129

If I do like this: parentID:[1242 TO 1242] I get the expected result.

Why is it like this, and how do I build this (parentID:[1242 TO 1242]) query from code ?
I basically just wanna find all child nodes to id = 1242

1 Like

Searching | Examine

Range queries
Range Queries allow one to match documents whose field(s) values are between the lower and upper bound specified by the Range Query

Float Range
Example:

var searcher = myIndex.Searcher;
var query = searcher.CreateQuery();
query.RangeQuery<float>(new[] { "SomeFloat" }, 0f, 100f, minInclusive: true, maxInclusive: true);
var results = query.Execute(QueryOptions.Default);
This will return results where the field SomeFloat is within the range 0 - 100 (min value and max value included).

parentID:1246 doesn’t return results because parentId is defined as an integer (FieldDefinitionTypes.Integer). Lucene doesn’t support direct equality queries on numeric fields using plain field:value syntax. However, parentId:[1246 TO 1246] works because it uses a numeric range query, which is how Examine handles searches on integer fields. Even if the range is just a single value, this is the correct approach.

id and templateID may work as don’t seem to be defined as integers?

1 Like

This is just crazy :smile: — I would have never guessed that parentID and id are not the same type; one node’s parentID references another node’s id, right? Or does the id double for the GUID in some scenarios?

/Chriztian

1 Like