Questions tagged [searchqueryset]

40 questions
1
vote
1 answer

Django Haystack SearchQuerySet order_by returning no results

I have Haystack working in "Old urls.py" below. When I try to order my search results using order_by on the model field 'canonical_school_score', as seen in "New urls.py," I keep getting no search results. Any suggestions on what I'm doing wrong? #…
wsvincent
  • 207
  • 4
  • 13
1
vote
1 answer

Wordpress complex search query into pretty permalinks

I just wondering if there is a way to convert Wordpress complex search query into pretty permalinks. From what I understand, there is a way to convert: www.domain.com/?s=keyword into www.domain.com/search/keyword However, what if you want to change…
1
vote
1 answer

Django Haystack Distinct Value for Field

I am building a small search engine using Django Haystack + Elasticsearch + Django REST Framework, and I'm trying to figure out reproduce the behavior of a Django QuerySet's distinct method. My index looks something like this: class…
0
votes
0 answers

How to get my search results to relevantly display what the user typed in (React JS)

I am using React JS to program a search bar, where a user can type in information and it takes them to a search results page. Here is my code: import React, { useState, useEffect } from 'react'; import { useParams, useNavigate } from…
0
votes
0 answers

How to annotate django complex queryset

I want to have count of usecases. I have three models Customer (all users records), Usecase (all usecases records) and CustomerUsecaseAssociation (users and subscriptions records). I want to count the subscriptions of each usecase subscribed by…
0
votes
1 answer

Django-filters, q objects & searching "contains" in manytomany & textfields at the same time

does anyone know anything about q objects and searching many to many fields? class tags(models.Model): name = models.CharField(max_length=20) def __str__(self): return self.name class Item(models.Model): item_id =…
GTEE
  • 11
  • 5
0
votes
1 answer

Don't understand how to do a search query with with or,and,not

I am reposting this question as I fixed it now to make it easier to understand exactly what I need to do. I have a function declared: set findQueryMatches(map>& index, string sentence); The map is an already filled map…
0
votes
0 answers

Search SQLite Query in Python

I make an employee record program in python. In this program, user can make search name, duty or education and can see for example all names contains 'Jennifer'. Employee informations holds on database therefore i am using some sql queries. For…
0
votes
1 answer

How to sort a result of objects shown after a search with keyword in Django

Actually i have a working code but the issue that i am facing is how to sort the result of the queryset based on multiple rule. This is my models.py : class Node(MPTTModel): parent = TreeForeignKey('self', on_delete=models.CASCADE,…
Farhani Walid
  • 927
  • 1
  • 9
  • 20
0
votes
2 answers

How to insert element into a field with django

What would be the best way to insert a variable into a field in django, similar to insert element into a list in python. I am not trying to update a record field "first_name" in the database but rather "insert" or "add" a second "first_name" from…
0
votes
1 answer

Retrieving pk from filtered Django QuerySet

I have a Sample model that is searched via a web interface and a QuerySet of criteria-matching Sample objects are returned as expected. model class Sample(models.Model): sample_name = models.CharField('Sample', max_length=16) html form
cer
  • 1,961
  • 2
  • 17
  • 26
0
votes
1 answer

Django QuerySet API inverse field lookup

I'm wondering if it is somehow possible to use "the inverse" of the __contains fields lookup. https://docs.djangoproject.com/en/1.11/ref/models/querysets/#contains So for example: class Person(models.Model): ... last_name =…
White
  • 134
  • 2
  • 9
0
votes
1 answer

exact matching does not work for SQ() in Haystack?

I am trying to use __exact in my Haystack and SOLR4 backend app, but it does not work for SQ() as expected. I am wondering whether __exact just works for SearchQuerySet class. This is my code: sqs = super(FacetedSearchForm, self).search() …
MC X
  • 337
  • 4
  • 16
0
votes
2 answers

Partial search not working on Elasticsearch+Haystack in spite of using Ngram and Edgengram for building index

I am building the indexes like : class BookIndex(indexes.SearchIndex,indexes.Indexable): text= indexes.EdgeNgramField(document=True,use_template=True) content_auto = indexes.EdgeNgramField(model_attr='title') isbn_13 =…
0
votes
1 answer

SearchQuerySet() 'or' query

I'm having difficulty returning the results for an 'or' query in a SearchQuerySet() (django-haystack). In some cases it works but in others it doesn't, so I'm wondering if it's an issue with how I'm calling the 'or' query. Currently, I want to…
Michael Smith
  • 3,307
  • 5
  • 25
  • 43