Make search work better
This commit is contained in:
parent
e2f7db9702
commit
4dabd6d5f6
3 changed files with 13 additions and 4 deletions
|
@ -76,13 +76,13 @@ get_factoid_search (depth, factoid_id, subject, copula, predicate, author, modif
|
||||||
WHERE NOT deleted
|
WHERE NOT deleted
|
||||||
ORDER BY original_subject ASC, depth ASC, factoid_id DESC
|
ORDER BY original_subject ASC, depth ASC, factoid_id DESC
|
||||||
)
|
)
|
||||||
SELECT ts_rank(full_document_tsvector, websearch_to_tsquery(?)) AS rank, *
|
SELECT ts_rank(full_document_tsvector, websearch_to_tsquery('factoid', ?)) AS rank, *
|
||||||
FROM get_factoid_search
|
FROM get_factoid_search
|
||||||
WHERE NOT deleted
|
WHERE NOT deleted
|
||||||
AND predicate IS NOT NULL
|
AND predicate IS NOT NULL
|
||||||
AND predicate <> ' '
|
AND predicate <> ' '
|
||||||
AND predicate <> ''
|
AND predicate <> ''
|
||||||
AND ts_rank(full_document_tsvector, websearch_to_tsquery(?)) > 0.01 ORDER BY 1 DESC
|
AND ts_rank(full_document_tsvector, websearch_to_tsquery('factoid', ?)) > 0.01 ORDER BY 1 DESC, factoid_id DESC
|
||||||
" , $namespace, $server, $search, $search)->hashes;
|
" , $namespace, $server, $search, $search)->hashes;
|
||||||
|
|
||||||
return $data
|
return $data
|
||||||
|
@ -94,7 +94,8 @@ sub autocomplete_factoids($self, $subject, $server, $namespace) {
|
||||||
|
|
||||||
sub get_namespaces($self) {
|
sub get_namespaces($self) {
|
||||||
my $data = $self->pg->db->query("
|
my $data = $self->pg->db->query("
|
||||||
SELECT server, namespace, alias_server, alias_namespace, parent_server, parent_namespace, recursive, command_prefix, generated_server, generated_namespace FROM factoid_config ORDER BY server ASC, namespace ASC
|
SELECT server, namespace, alias_server, alias_namespace, parent_server, parent_namespace, recursive, command_prefix, generated_server, generated_namespace, notes
|
||||||
|
FROM factoid_config ORDER BY server ASC, namespace ASC
|
||||||
")->hashes;
|
")->hashes;
|
||||||
|
|
||||||
return $data
|
return $data
|
||||||
|
@ -133,4 +134,4 @@ SELECT * FROM get_latest_factoid ORDER BY factoid_id DESC;
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -3,3 +3,7 @@ secrets:
|
||||||
- 8b65a9c96109d010dded8bfc6623a95ace24afc1
|
- 8b65a9c96109d010dded8bfc6623a95ace24afc1
|
||||||
dsn: postgresql://perlbot:bar@192.168.32.1/perlbot
|
dsn: postgresql://perlbot:bar@192.168.32.1/perlbot
|
||||||
memcache_server: 192.168.32.1:11211
|
memcache_server: 192.168.32.1:11211
|
||||||
|
mojolicious:
|
||||||
|
hypnotoad:
|
||||||
|
listen:
|
||||||
|
- http://127.0.0.1:3020
|
||||||
|
|
|
@ -12,6 +12,7 @@ Pick a namespace to continue:
|
||||||
<th>parent</th>
|
<th>parent</th>
|
||||||
<th>factoid list</th>
|
<th>factoid list</th>
|
||||||
<th>search factoids</th>
|
<th>search factoids</th>
|
||||||
|
<th>notes</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% for my $ns ($configs->to_array->@*) {
|
<% for my $ns ($configs->to_array->@*) {
|
||||||
|
@ -58,6 +59,9 @@ Pick a namespace to continue:
|
||||||
<td>
|
<td>
|
||||||
<a href="/<%= $uenc->($server) =%>/<%= $uenc->($namespace) =%>/search">search</a>
|
<a href="/<%= $uenc->($server) =%>/<%= $uenc->($namespace) =%>/search">search</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= $ns->{notes} =%>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Add table
Reference in a new issue