Show DB index in search results.
Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
parent
1a3b4eb5a6
commit
6d55737cdc
8
markit
8
markit
@ -237,7 +237,7 @@ def searchdb(cur, keywords):
|
||||
arguments = []
|
||||
arguments.append(searchtag)
|
||||
placeholder = "'%' || ? || '%'"
|
||||
query = "SELECT url, metadata, tags FROM bookmarks WHERE tags LIKE (%s)" % placeholder
|
||||
query = "SELECT id, url, metadata, tags FROM bookmarks WHERE tags LIKE (%s)" % placeholder
|
||||
if searchAll == True: # Match all keywords in URL or Title
|
||||
query += " OR ("
|
||||
for token in keywords:
|
||||
@ -264,9 +264,9 @@ def searchdb(cur, keywords):
|
||||
count = 0
|
||||
results = []
|
||||
for row in cur.execute(query, arguments):
|
||||
results.append(row[0])
|
||||
results.append(row[1])
|
||||
count += 1
|
||||
print("\x1B[1m\x1B[93m%d. \x1B[0m\x1B[92m%s\x1B[0m\n\t%s\n\t\x1B[91m[TAGS]\x1B[0m %s" % (count, row[0], row[1], row[2][1:-1]))
|
||||
print("\x1B[1m\x1B[93m%d. \x1B[0m\x1B[92m%s\x1B[0m (%d)\n\t%s\n\t\x1B[91m[TAGS]\x1B[0m %s" % (count, row[1], row[0], row[2], row[3][1:-1]))
|
||||
|
||||
if count == 0:
|
||||
return
|
||||
@ -274,7 +274,7 @@ def searchdb(cur, keywords):
|
||||
print("")
|
||||
|
||||
while True:
|
||||
nav = input("Index number to open: ")
|
||||
nav = input("Result number to open: ")
|
||||
if is_int(nav):
|
||||
index = int(nav) - 1
|
||||
if index < 0:
|
||||
|
5
markit.1
5
markit.1
@ -58,7 +58,10 @@ in DB.
|
||||
Show all bookmark records from the DB along with actual index. Shows URL, title data and tags.
|
||||
.TP
|
||||
.BI \-s " keywords"
|
||||
Search bookmarks for a (partial) tag or keywords and show the results. Prompts to enter result number to open in browser. Note that the sequential index number may not match the real index in database. Shows URL, title data and tags.
|
||||
Search bookmarks for a (partial) tag or any keyword and show the results. Prompts to enter result number to open in browser. Note that the sequential index number may not match the real index in database. DB index is shown in the end within `()`.
|
||||
.TP
|
||||
.BI \-S " keywords"
|
||||
Search bookmarks for a (partial) tag or occurrence of all keywords in URL or title data and show the results. Rest same as `-s`.
|
||||
.TP
|
||||
.BI \-u " N"
|
||||
Update bookmark at index
|
||||
|
Loading…
Reference in New Issue
Block a user