Questions tagged [searchqueryset]
40 questions
3
votes
1 answer
Merge multiple SearchQuerySet
I use Haystack and solr for a global search with multiple models , i try to use different filter on models, but at the end i have to return 1 queryset, i don't find how to merge this.
#views
from haystack.generic_views import SearchView
class…

V1ce
- 63
- 8
3
votes
1 answer
How to filter results using django-haystack SearchQuerySet?
I'm attempting to use django-haystack + whoosh in my Django application. My index class looks like this
class ArticleIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
title =…

AndrewSmiley
- 1,933
- 20
- 32
2
votes
1 answer
Can OR-clauses be combined with distance filters in Haystack for Django?
I've been using a distance filter using regular django query filters within an OR-clause:
# either it's within the preset distance of the location
# OR it's not an in-person event
self.filter(Q(location__distance_lt=(geometry, LOCATION_WITHIN_D)) |…

Rob G
- 3,496
- 1
- 20
- 29
2
votes
1 answer
What is the difference between using __exact and Exact()?
I am using Solr search for Django application using Haystack. In order to get more precise result, I had to change the search query to perform exact search -
from haystack.query import SearchQuerySet, SQ
from haystack.inputs import Exact
....
query…

Mutant
- 3,663
- 4
- 33
- 53
2
votes
1 answer
Union of 2 SearchQuerySet in django haystack
Is there any way to get an union of two or more searchqueryset ? For example :-
query1 = SearchQuerySet().filter(authors=query)
query2 = SearchQuerySet().filter(title=query)
How do I combine both the queries together so that i get a union of the 2…

Subhajit
- 361
- 1
- 4
- 18
2
votes
2 answers
Django Haystack with elasticsearch returning empty queryset while data exists
I am doing a project in Python, django rest framework. I am using haystack SearchQuerySet. My code is here.
from haystack import indexes
from Medications.models import Salt
class Salt_Index(indexes.SearchIndex, indexes.Indexable):
text =…

Ashok Joshi
- 428
- 4
- 13
2
votes
1 answer
How can I filter SearchQuerySet results based on a specifice model and an ID
This is the model, in which I want to search
class itemType(models.Model):
partNumber = models.CharField(max_length = 12, null = True)
designation = models.CharField(max_length = 200, null = True)
timeCreate = models.DateTimeField() #auto…

eljobso
- 352
- 2
- 6
- 20
2
votes
1 answer
haystack SearchQueryResult object returns multiple objects
I don't get why get() with pk=1 would result in multiple objects returned below..
sqs = SearchQuerySet().more_like_this(self)
for obj in sqs:
do something with obj.object # obj.object results in error
get() returned more than one MyModel --…

eugene
- 39,839
- 68
- 255
- 489
1
vote
2 answers
The rendered input is acting as object rather than string in React
The rendered input is getting interpreted as word 'object' rather than text getting entered in input in React. So I have this API I want to search with input while I am searching it is getting written word 'object' rather than what am I…

Stucked_sucks
- 13
- 4
1
vote
1 answer
How to make a search query in MongoDB
I have profiles in a collection called Profiles. I am making the query to search profiles based on user
provided fields. Searching Form(UI Form), User have different options to search profiles like 'female' or 'male' or 'Any' and click on Search…

M.Shahid
- 13
- 3
1
vote
0 answers
Making Django-haystack autocomplete suggestions work for accented query (à, é, ï, etc..)
I'm trying to make the suggestions from Django-haystack' autocomplete to be sensitive to words containing accents. (For french language)
Current result:
User type Seville
Output suggestion returns nothing because the actual destination name is…

locq
- 301
- 1
- 5
- 22
1
vote
1 answer
Add additional fields after phone number lookup in the database in Django
I am building an app that look for each phone number in the database. If there is any duplicate, I want to grab the first phone number found as the main record for that phone number, then for the duplicate information(name, location), get each one…

Curtis Banks
- 342
- 4
- 20
1
vote
1 answer
Filtering drf-haystack results by current user
I'm currently using Django 1.10.3, django-haystack search engine with elasticsearch backend, and drf-haystack to prove the views.
The searches in general have been great, but I am completely unable to filter results by current user.
The index…

Derek
- 51
- 7
1
vote
2 answers
How to get n search objects from a SearchQuerySet without changing the type?
I am trying to get the to 10 objects like :
q_auth = SearchQuerySet().filter(content=validate_query)
q_auth = q_auth[:10]
print type(q_auth)
The output I want is: but I am getting is .
Can some…

Subhajit
- 361
- 1
- 4
- 18
1
vote
1 answer
Intersection of two SearchQuerySets in Django
So I have a similar model:
class Whatever(SlugMixin, models.Model):
user = models.ForeignKey(auth_models.User, related_name='user+', verbose_name=_('User'), on_delete=models.PROTECT)
name = models.CharField(verbose_name=_('Name'),…

elena
- 3,740
- 5
- 27
- 38