SYN-10419: unified Storm lookup mode, search, and scrape combined#4874
SYN-10419: unified Storm lookup mode, search, and scrape combined#4874MichaelSquires wants to merge 7 commits intosynapse-3xxfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## synapse-3xx #4874 +/- ##
============================================
Coverage 96.22% 96.23%
============================================
Files 259 259
Lines 63206 63216 +10
============================================
+ Hits 60823 60833 +10
Misses 2383 2383
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR is looking solid. Have we ( especially anybody who has touched synapse-search ) gotten a chance to think through the "remove the scrape values" vs not idea? It does seem like there could be some that would actually match full text search, like |
synapse/datamodel.py - Added self._lookup_hints = None cache attribute to Model.__init__() - Added getLookupHints() method that collects (prop_full_name, cmpr) tuples from: - Forms whose type has modes.lookup in its info (covers entity:name, it:softwarename) - Props that directly have modes.lookup in prop.info (covers syn:tag:base) - Added self._lookup_hints = None cache invalidation in addForm, delForm, _addFormProp, and delFormProp synapse/lib/ast.py (Lookup.run()) - Replaced the search interface block with hint-based lookups: for each remainder token, iterate through getLookupHints() and lift nodes via view.nodesByPropValu() with the specified comparator - Deduplication via s_spooled.Set is preserved - Bad value/comparator exceptions per-prop are caught and skipped gracefully synapse/cortex.py - Removed storm:interface:search config Tests, docs, changelog — updated to reflect the new behavior.
| async with await s_spooled.Set.anit(dirn=view.core.dirn, cell=view.core) as buidset: | ||
|
|
||
| todo = s_common.todo('search', tokns) | ||
| async for (prio, buid) in view.mergeStormIface('search', todo): | ||
| if buid in buidset: | ||
| await asyncio.sleep(0) | ||
| continue | ||
| for tokn in remainder.split(): | ||
| for prop_name, cmpr in hints: | ||
| try: | ||
| async for node in view.nodesByPropValu(prop_name, cmpr, tokn): | ||
| if node.buid in buidset: | ||
| await asyncio.sleep(0) | ||
| continue | ||
|
|
||
| await buidset.add(node.buid) |
There was a problem hiding this comment.
| async with await s_spooled.Set.anit(dirn=view.core.dirn, cell=view.core) as buidset: | |
| todo = s_common.todo('search', tokns) | |
| async for (prio, buid) in view.mergeStormIface('search', todo): | |
| if buid in buidset: | |
| await asyncio.sleep(0) | |
| continue | |
| for tokn in remainder.split(): | |
| for prop_name, cmpr in hints: | |
| try: | |
| async for node in view.nodesByPropValu(prop_name, cmpr, tokn): | |
| if node.buid in buidset: | |
| await asyncio.sleep(0) | |
| continue | |
| await buidset.add(node.buid) | |
| async with await s_spooled.Set.anit(dirn=view.core.dirn, cell=view.core) as nidset: | |
| for tokn in remainder.split(): | |
| for prop_name, cmpr in hints: | |
| try: | |
| async for node in view.nodesByPropValu(prop_name, cmpr, tokn): | |
| if node.nid in nidset: | |
| await asyncio.sleep(0) | |
| continue | |
| await nidset.add(node.nid) |
There was a problem hiding this comment.
can use nid rather than buid here
| offset = info.get('offset') | ||
| if match is None or offset is None: | ||
| continue | ||
| remainder = remainder[:offset] + remainder[offset + len(match):] |
There was a problem hiding this comment.
Would it be better to remove up to the next whitespace/end of line rather than potentially removing partial tokens? Seems like prefix matching on a partial string that was leftover might not be ideal
No description provided.