-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Filter search on top concepts #128
Comments
Hi! You mean that you want to restrict a search to concepts that are descendant from a certain top concept? I think we had other features in mind that have the same premise (looking at a particular subtree only, e.g. gbv/jskos-metrics#9), so it's certainly worth looking into it. I'm wondering how we could implement this efficiently. Maybe @nichtich has an idea? |
We could generate and index the Maybe MongoDB graphLookup can help. The field to build the graph from is |
Yes, my use case in monohierarchical. I will have a look at the graphLookup of MongoDB. I will post my findings here in any case, but this will take some time.... |
$graphLookup can definitely be used to implement this, but I'm not sure if it's possible to do it efficiently, i.e. without having to go through the whole Concepts collection. |
I played around with $graphLookup a little bit (also because it might be useful for a different issue) and found something that could work, however only in a restricted fashion: db.getCollection('concepts').aggregate([
{
$match: { uri: "http://rvk.uni-regensburg.de/nt/A" }
},
{
$graphLookup: {
from: "concepts",
startWith: "$uri",
connectFromField: "uri",
connectToField: "broader.uri",
as: "descendant",
restrictSearchWithMatch: {
_keywordsLabels: { $regex: "^BIB" }
}
}
},
{
$unwind: "$descendant"
},
{
$replaceRoot: { newRoot: "$descendant" }
}
]) So we match only the desired parent concept (doesn't have to be a top concept), then we do a graph lookup like @nichtich described, but in reverse (matching from Why did I say "restricted fashion"? The problem is that I'm mostly writing this down to document my findings. I still haven't fully grasped (@nichtich's first solution, i.e. generating and indexing an |
This may be beyond the scope of this project, but would be very useful. I would like to filter search results by top concepts.
Any idea, how this could be achieved?
The text was updated successfully, but these errors were encountered: