Commit Graph

6 Commits

Author SHA1 Message Date
mpl 2088ce739b search: sort by creation time
Change-Id: I3695d91dde0d42419c62a23f20ba19416c53e5ef
2014-05-08 18:55:53 +02:00
Brad Fitzpatrick 79fb299ff6 search: server-side search expression eval + result set continuation tokens
Search expressions (e.g. "tag:funny location:Portland") can now be
evaluated server-side (expr.go and expr_test.go, still nascent). Next
step is to remove this parsing and construction from the javascript UI
code.

In addition, the search result now contains a continuation token to
continue interating through the result sets in a subsequent query.
The Javascript UI should use this now instead of parsing out
modification times of things and altering the search.  If there's no
continuation token, that either means the end has been reached, or
that search type doesn't [yet] support iteration. Currently only
permanode-based queries are supported at many layers, including
continuation, but will be implemented later.

For now, the web UI should send a search query "expression" value of
non-zero length but just whitespace (like a single space: " ") to get
the home page (recently-modified permanodes") because setting both to
the zero value is an input validation error.  We should probably make
an expression operator to be more clear here (like "want:permanode
sort:recent").  But the empty space hack works for now.

Change-Id: I3ea92eb8c776159f53c49db1a7439a91c507940a
2013-12-21 15:59:11 -08:00
Brad Fitzpatrick a0576f2c0d Fix corpus/search locking bugs.
The WebSockets live queries exposed a latent locking bug: the search
code was acquiring the Corpus read lock multiple times.  If a write
came in during the middle of a search, between two read locks, the
second RLock would hang (since a writer lock was pending) and then the
search and write would deadlock.

Instead, just acquire the read lock once at the beginning of the query and
never re-acquire it.  For now: new "Locked" versions of all the Corpus APIs.
In the future: will probably just add the locked-or-not into the context, and make
sure all Corpus methods require a *context.Context.

Also fix two potential data races: one with LogicalCondition (which
might've raced on the scratch ss buffer, depending on the query), and
a test-only race that didn't matter in production, but was annoying in
tsan output regardless, so fixed.

More tests to follow later. Unblocking Aaron for now.

Change-Id: Ie1edcbd061235f1ef04f9b4c68b86814c84361af
2013-12-12 11:34:07 +04:00
Brad Fitzpatrick b020f60390 search: add test for earlier fix in commit 1e1183a8bf
Change-Id: I95c0f885079de17cd1c52b9ad40861c96eb5308c
2013-12-07 10:53:30 -08:00
Brad Fitzpatrick cad54aa249 search: fix a panic in Query w/ describe, add tests
Change-Id: I4a2288298fbab8a51c795b9eaed5fc3488024132
2013-12-03 18:24:02 -08:00
mpl 5344af8e39 search handler: more tests, and fix for the describe depth race
http://camlistore.org/issue/121

Change-Id: I5807df784d9bd47f3cc8720a891d458ee722013b
2013-03-06 19:04:10 +01:00