Skip to content

Commit

Permalink
add: trace log example
Browse files Browse the repository at this point in the history
  • Loading branch information
hhatto committed Nov 28, 2023
1 parent 4232ed5 commit 84efdcd
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions examples/groonga_microblog_tutorial/4_search_with_trace_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from poyonga import Groonga


def _call(g, cmd, **kwargs):
ret = g.call(cmd, **kwargs)
print("status:", ret.status)
if cmd == "select":
print("item:", len(ret.items))
for item in ret.items:
print(item)
print(f"[trace_log] {ret.trace_logs}")
print("=*=" * 30)


g = Groonga()

_call(
g,
"select",
table="Users",
match_columns="name,location_str,description",
query="東京",
output_columns="_key,name",
output_trace_log="yes",
command_version="3",
)
_call(
g,
"select",
table="Users",
filter='geo_in_circle(location,"128484216x502919856",5000)',
output_columns="_key,name",
output_trace_log="yes",
command_version="3",
)
_call(
g,
"select",
table="Comments",
filter="last_modified<=1268802000",
output_columns="posted_by.name,comment,last_modified",
drilldown="hash_tags,posted_by",
output_trace_log="yes",
command_version="3",
)

0 comments on commit 84efdcd

Please sign in to comment.