Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#7376 closed enhancement (fixed)

searching published worksheets does not work to just search for username

Reported by: jason Owned by: boothby
Priority: minor Milestone: sage-4.3
Component: notebook Keywords:
Cc: was Merged in: sagenb-0.4.6
Authors: Mitesh Patel Reviewers: William Stein
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

It would be really nice if the "Search" function in the upper left of the published worksheet listing also searched for the username (e.g., I could search for "jason3" and get all of my published worksheets).

Attachments (2)

trac_7376-search_by_username.patch (882 bytes) - added by mpatel 10 years ago.
Search by publisher. Apply to sagenb repo.
trac_7376-search_by_username_v2.patch (985 bytes) - added by mpatel 10 years ago.
Alternate version: Search by owner and publisher. Apply only this patch to sagenb repo.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by mpatel

We should also consider supporting more complex queries, e.g., on an "Advanced Search" page. By the way, according to codenode-devel, Codenode uses Whoosh for full-text search.

comment:2 Changed 10 years ago by mpatel

It seems this will work:

  • sagenb/notebook/worksheet.py

    diff --git a/sagenb/notebook/worksheet.py b/sagenb/notebook/worksheet.py
    a b class Worksheet(object): 
    19731973        """
    19741974        # Load the worksheet data file from disk.
    19751975        filename = self.worksheet_html_filename()
    1976         r = (self.owner().lower() + ' ' + self.name().lower() + ' '
     1976        r = (self.publisher().lower() + ' ' + self.name().lower() + ' '
    19771977             + open(filename).read().lower())
    19781978        # Check that every single word is in the file from disk.
    19791979        for W in split_search_string_into_keywords(search):

comment:3 Changed 10 years ago by mpatel

But:

sage: from sagenb.notebook.worksheet import split_search_string_into_keywords as ss
sage: ss('hello there')
['hello', 'there']
sage: ss(" foo bar  'modular form' hello there")
['modular form', "'", 'hello', 'there']

Pyparsing is another alternative. There's a search query parser among the examples. The license appears to be a modified-BSD license.

Should we add modifiers? For example, the search phrase "Fourier user:joe would restrict the search to worksheets published by Joe. Other possible modifiers: title, text_cell, compute_cell, dates, input, output, collaborators, rating.

Changed 10 years ago by mpatel

Search by publisher. Apply to sagenb repo.

Changed 10 years ago by mpatel

Alternate version: Search by owner and publisher. Apply only this patch to sagenb repo.

comment:4 Changed 10 years ago by mpatel

  • Authors set to Mitesh Patel
  • Status changed from new to needs_review

Should we do more with this ticket?

comment:5 Changed 10 years ago by was

  • Report Upstream set to N/A
  • Status changed from needs_review to positive_review

Nice; this works as advertised.

I like all the discussion above about even more sophisticated searching systems, but of course they shouldn't hold up this ticket getting a... positive review!

comment:6 Changed 10 years ago by was

  • Resolution set to fixed
  • Status changed from positive_review to closed

I merged this patch into sagenb-0.4.6.

comment:7 Changed 10 years ago by mvngu

  • Merged in set to sagenb-0.4.6
  • Reviewers set to William Stein
Note: See TracTickets for help on using tickets.