Information retrieval system (movies query)
In order to rate movies, the user needs to search for them using the home page:
By Typing some relevant words in the text box, the page will call (through the urls.py
corresponding home URL) the home
function in the views.py
file:
def home(request): context={} if request.method == 'POST': post_data = request.POST data = {} data = post_data.get('data', None) if data: return redirect('%s?%s' % (reverse('books_recsys_app.views.home'), urllib.urlencode({'q': data}))) elif request.method == 'GET': get_data = request.GET data = get_data.get('q',None) titles = cache.get('titles') if titles==None: print 'load data...' texts = [] mobjs = MovieData.objects.all() ndim = mobjs[0].ndim matr = np.empty([1,ndim]) titles_list = [] cnt=0 for obj in mobjs...