-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot filter by parentID in lucene query with GroupedOr #6316
Comments
ParentId is indexed as numeric data. Fields that are of a numeric type must be queried with a range query or using the lucene numeric apis. This is why you see the generated query for parent ID using a range query when using the Examine APIs. Examine does not support numeric data fields using the methods like Examine 1.0 support nested query operations so you should be able to accomplish what you need without using the I haven't had time to update the Examine docs for v1.0 so unfortunately i can't point you to any docs, but i can point you to some code: https://github.com/Shazwazza/Examine/blob/master/src/Examine.Test/Search/FluentApiTests.cs#L1810 Also note that when you use Examine APIs to query a field like |
So just to be clear, I have to generate a raw query that looks like the following? +(parentID:[1234 TO 1234] parentID:[1235 TO 1235]) This is why I was using GroupedOr, as I needed to require the query to match one of a set of ids. I don't think I can use Field because of this requirement. It seems I will need to use the NativeQuery helper, though I have had issues in the past where it modifies my queries (mostly moving around where the parenthesis are). I still need to test whether that happens for this particular query though. Will post an update once I've done so. |
I'm still running into issues making this query. I'm able to generate a raw query with the form
which is then compiled to the below query when run through the NativeQuery helper
For queries with multiple ids, it looks like
and
Both of the generated queries look like they should work. Unfortunately I get 0 results with these queries. It's not a problem of data missing from the index, as I do get results when I run the query with the ParentId helper, so I'm at a bit of a loss as to what's going wrong. |
Hi,
No, that's not what i mentioned above. I said
The examples I pointed you too use nested query operations like That said you can also try just using raw queries. Can post the code that you are actually using? I'd suggest you use Luke to debug your queries and index to see what is going on, you need version 1.0.1 from here https://code.google.com/archive/p/luke/downloads, also there's both inclusive and exclusive syntax for range queries, see https://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Range%20Searches You can also debug the output of the strongly typed syntax by doing a ToString() on the IQuery generated and it will show you the compiled raw query being used. |
Forgot to mention that this code is just running against the built in ExternalIndex. |
Sorry for the delay, So there's 2 issues here and I figured out your first issue where raw range queries don't work with numerical values, see Shazwazza/Examine#133, have a working prototype of that one but still need more fixing. Lets keep that discussion on the Examine tracker since this is nothing to do with Umbraco's code. As for your other issue, if you could post this as a separate question on the Examine repo, i can see if i can find time to help but. And yes, in luke, you cannot run range queries on numerically stored values, it's the same problem and luke will not be able to turn those into numerical range queries. |
K. I've created a new issue report for the issue I've run into with the "And()" method. |
I'm trying to make a lucene query that does a search for child nodes beneath specific pages with the option for additional filtering options [here[(https://github.com/Shazwazza/Examine/wiki/Grouped-Operations). Unfortunately, this does not return any results, even though the query looks correct.
Previously I had been using multiple parentId calls, which works fine until other conditions are involved. I need the result to match at least one of the parentID's, which requires grouping.
Reproduction
Bug summary
GroupedOr examine query fails to find any matches in the ExternalIndex, even though the same query done with query done with the ParentId helper does return results. These do generate different queries "parentID:1234" vs "(parentID:[1234 TO 1234])," though I'm not sure why the structure used by the ParentId is needed, as the former query looks fine to me.
Specifics
Umbraco: 8.1.3
Steps to reproduce
Expected result
The search result includes the one child node of the first node created.
Actual result
No matches were found.
The text was updated successfully, but these errors were encountered: