Show tags in search result.

Show tags as last row in all results.

Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
Arun Prakash Jana 2015-11-09 06:01:29 +05:30
parent a3ed4cdc0d
commit 8a70865e8e
3 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@ It's advisable to copy URLs directly from the browser address bar, i.e., along
You can either add or update or delete record(s) in one instance. A combination of these operations are not supported in a single instance. The same URL cannot be added twice. You can update tags and title data or delete it.
Search works in mysterious ways. All the keywords are treated as a single tag together. Partial sequential tag matches are shown in results. The same keywords are separately searched as unique tokens so that entries with matching URL or title data are also shown in results.
Search works in mysterious ways. All the keywords are treated as a single tag together. Bookmarks with partial sequential tag matches are shown in results. The same keywords are separately searched as unique tokens so that entries with matching URL or title data are also shown in results.
`markit` is GPLv3 licensed.

6
markit
View File

@ -218,7 +218,7 @@ def searchdb(cur, keywords):
arguments = []
arguments.append(searchtag)
placeholder = "'%' || ? || '%'"
query = "SELECT url, metadata FROM bookmarks WHERE tags LIKE (%s)" % placeholder
query = "SELECT url, tags, metadata FROM bookmarks WHERE tags LIKE (%s)" % placeholder
for token in keywords:
query += " OR URL LIKE (%s) OR metadata LIKE (%s)" % (placeholder, placeholder)
arguments.append(token)
@ -231,7 +231,7 @@ def searchdb(cur, keywords):
for row in cur.execute(query, arguments):
results.append(row[0])
count += 1
print("\x1B[1m\x1B[93m%d. \x1B[0m\x1B[92m%s\x1B[0m\n\t%s" % (count, row[0], row[1]))
print("\x1B[1m\x1B[93m%d. \x1B[0m\x1B[92m%s\x1B[0m\n\t%s\n\t[TAGS] %s" % (count, row[0], row[2], row[1][1:-1]))
if count == 0:
return
@ -290,7 +290,7 @@ def cleardb(conn, cur, entry):
# Print all records in the table
def printdb(cur):
for row in cur.execute('SELECT * FROM bookmarks'):
print("\x1B[1m\x1B[93m%s. \x1B[0m\x1B[92m%s\x1B[0m\n\t[TAGS] %s\n\t[META] %s" % (row[0], row[1], row[2][1:-1], row[3]))
print("\x1B[1m\x1B[93m%s. \x1B[0m\x1B[92m%s\x1B[0m\n\t%s\n\t[TAGS] %s" % (row[0], row[1], row[3], row[2][1:-1]))

View File

@ -40,10 +40,10 @@ of the database. Works only if `-a` option is used. Use this option to fill blan
Fetch title data from the web. Works only with `-a` or `-u` options.
.TP
.B \-p
Show all bookmark records from the database along with actual index. Shows URL, tags and title data.
Show all bookmark records from the database 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. The results show URL and title data (tags are not shown).
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. The results show URL, title data and tags.
.TP
.BI \-u " N"
Update bookmark at index