Browse Source

Update search

pull/10/head
Hironsan 6 years ago
parent
commit
a57f6f39d8
3 changed files with 5 additions and 11 deletions
  1. 5
      doccano/app/server/static/annotation.1.js
  2. 9
      doccano/app/server/templates/annotation.1.html
  3. 2
      doccano/app/server/views.py

5
doccano/app/server/static/annotation.1.js

@ -26,7 +26,6 @@ var vm = new Vue({
total: 0,
remaining: 0,
searchQuery: '',
history: []
},
methods: {
@ -90,7 +89,9 @@ var vm = new Vue({
axios.get('/' + base_url + '/apis/search?keyword=' + this.searchQuery)
.then(function (response) {
console.log('search response');
self.history = response.data['data'];
console.log(response.data['data']);
self.items = response.data['data'];
self.searchQuery = '';
})
.catch(function (error) {
console.log('ERROR!! happend by Backend.')

9
doccano/app/server/templates/annotation.1.html

@ -8,15 +8,6 @@
<span class="compose">Active Learn</span>
</a>
</div>
<!--
<div class="main">
<a href="#" class="item active">
<span class="icon">
<i class="fa fa-inbox"></i>
</span>
<span class="name">Inbox</span>
</a>
</div>-->
<aside class="menu">
<p class="menu-label" style="color:#f2f2f2;">
Progress

2
doccano/app/server/views.py

@ -82,6 +82,8 @@ class SearchAPI(View):
docs = Document.objects.filter(text__contains=keyword)
labels = [[a.as_dict() for a in Annotation.objects.filter(data=d.id)] for d in docs]
docs = [{**d.as_dict(), **{'labels': []}} for d in docs]
if not docs:
docs = [{'id': None, 'labels': [], 'text': ''}]
# Annotation.objects.select_related('data').all().filter(data__text__contains=keyword)
return JsonResponse({'data': docs})

Loading…
Cancel
Save