no search results Django 2.1 Solr 6.5
I implemented solr 6.5 for django 2.1 with haystack 2.5 and i succesfully built index but theres still no search results
q*:* returns
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"*:*",
"indent":"on",
"wt":"json",
"_":"1543140724323"}},
"response":{"numFound":5,"start":0,"docs":[
{
"id":"blog.post.1",
"django_ct":["blog.post"],
"publish":["2019-05-26T04:46:00+00:00Z"],
"text":["Chwalmy wodzansanacja, wódz, historia, sumienienBo jeden jest wódznn"],
"django_id":[1],
"_version_":1618099571920994304},
{
"id":"blog.post.3",
"django_ct":["blog.post"],
"publish":["2018-11-15T20:59:39+00:00Z"],
"text":["Trwoga Krzyk Gardłowynwódznsomenn"],
"django_id":[3],
"_version_":1618099571923091456},
{
"id":"blog.post.4",
"django_ct":["blog.post"],
"publish":["2018-11-15T21:24:01+00:00Z"],
"text":["Jeszcze jeden postnsanacja, wódznChwalmy wodzann"],
"django_id":[4],
"_version_":1618099571924140032},
{
"id":"blog.post.5",
"django_ct":["blog.post"],
"publish":["2018-11-21T14:41:25+00:00Z"],
"text":["Yepnsanacja, wódznffffnn"],
"django_id":[5],
"_version_":1618099571925188608},
{
"id":"blog.post.7",
"django_ct":["blog.post"],
"publish":["2018-11-21T21:30:30+00:00Z"],
"text":["Markdownnhistoria, sanacja, wódzn*wyróżnienie* **pogrubienie**nlistę:nnnnnSometimes you want bullet points:nn* Start a line with a starn* Profit!n* Start a line with a starn* ElsennTutaj jest [sabaton](https://www.youtube.com/watch?v=_HLNMfCBUb0)nn"],
"django_id":[7],
"_version_":1618099571925188609}]
So core is populated
My view:
def post_search(request):
form = SearchForm()
if 'query' in request.GET:
form = SearchForm(request.GET)
if form.is_valid():
cd = form.cleaned_data
results = SearchQuerySet().models(Post)
.filter(content=cd['query']).load_all()
# Obliczenie całkowitej liczby wyników.
total_results = results.count()
return render(request,
'blog/post/search.html',
{'form': form,
'cd': cd,
'results': results,
'total_results': total_results})
else:
return render(request,
'blog/post/search.html',
{'form': form})
And my form
class SearchForm(forms.Form):
query = forms.CharField()
I tried procedure proposed by haystack itself
>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet().all()
>>> sqs.count()
But I only recived
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/query.py", line 522, in count
return len(self)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/query.py", line 86, in __len__
self._result_count = self.query.get_count()
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/__init__.py", line 619, in get_count
self.run()
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 802, in run
results = self.backend.search(final_query, **search_kwargs)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/__init__.py", line 33, in wrapper
return func(obj, query_string, *args, **kwargs)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 149, in search
distance_point=kwargs.get('distance_point'))
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 425, in _process_results
app_label, model_name = raw_result[DJANGO_CT].split('.')
AttributeError: 'list' object has no attribute 'split'
So here's the problem, posts are indexed but unable to search and I really run out of ideas at this point
django solr
add a comment |
I implemented solr 6.5 for django 2.1 with haystack 2.5 and i succesfully built index but theres still no search results
q*:* returns
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"*:*",
"indent":"on",
"wt":"json",
"_":"1543140724323"}},
"response":{"numFound":5,"start":0,"docs":[
{
"id":"blog.post.1",
"django_ct":["blog.post"],
"publish":["2019-05-26T04:46:00+00:00Z"],
"text":["Chwalmy wodzansanacja, wódz, historia, sumienienBo jeden jest wódznn"],
"django_id":[1],
"_version_":1618099571920994304},
{
"id":"blog.post.3",
"django_ct":["blog.post"],
"publish":["2018-11-15T20:59:39+00:00Z"],
"text":["Trwoga Krzyk Gardłowynwódznsomenn"],
"django_id":[3],
"_version_":1618099571923091456},
{
"id":"blog.post.4",
"django_ct":["blog.post"],
"publish":["2018-11-15T21:24:01+00:00Z"],
"text":["Jeszcze jeden postnsanacja, wódznChwalmy wodzann"],
"django_id":[4],
"_version_":1618099571924140032},
{
"id":"blog.post.5",
"django_ct":["blog.post"],
"publish":["2018-11-21T14:41:25+00:00Z"],
"text":["Yepnsanacja, wódznffffnn"],
"django_id":[5],
"_version_":1618099571925188608},
{
"id":"blog.post.7",
"django_ct":["blog.post"],
"publish":["2018-11-21T21:30:30+00:00Z"],
"text":["Markdownnhistoria, sanacja, wódzn*wyróżnienie* **pogrubienie**nlistę:nnnnnSometimes you want bullet points:nn* Start a line with a starn* Profit!n* Start a line with a starn* ElsennTutaj jest [sabaton](https://www.youtube.com/watch?v=_HLNMfCBUb0)nn"],
"django_id":[7],
"_version_":1618099571925188609}]
So core is populated
My view:
def post_search(request):
form = SearchForm()
if 'query' in request.GET:
form = SearchForm(request.GET)
if form.is_valid():
cd = form.cleaned_data
results = SearchQuerySet().models(Post)
.filter(content=cd['query']).load_all()
# Obliczenie całkowitej liczby wyników.
total_results = results.count()
return render(request,
'blog/post/search.html',
{'form': form,
'cd': cd,
'results': results,
'total_results': total_results})
else:
return render(request,
'blog/post/search.html',
{'form': form})
And my form
class SearchForm(forms.Form):
query = forms.CharField()
I tried procedure proposed by haystack itself
>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet().all()
>>> sqs.count()
But I only recived
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/query.py", line 522, in count
return len(self)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/query.py", line 86, in __len__
self._result_count = self.query.get_count()
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/__init__.py", line 619, in get_count
self.run()
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 802, in run
results = self.backend.search(final_query, **search_kwargs)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/__init__.py", line 33, in wrapper
return func(obj, query_string, *args, **kwargs)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 149, in search
distance_point=kwargs.get('distance_point'))
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 425, in _process_results
app_label, model_name = raw_result[DJANGO_CT].split('.')
AttributeError: 'list' object has no attribute 'split'
So here's the problem, posts are indexed but unable to search and I really run out of ideas at this point
django solr
you should show the full stack trace. as it is, the error description you have here isn't enough.
– Jason
Nov 25 '18 at 12:56
Ok I just added that
– Kajetan Radulski
Nov 25 '18 at 13:09
1
ok so its an issue inside haystack, asa you can see from the paths in the stack trace. googlingdjango haystack attribute error list object has no attribute split
returns a number of results, including github.com/django-haystack/django-haystack/issues/1200 which might help
– Jason
Nov 25 '18 at 13:16
My initial guess is that you haven't made Solr use the generated schema from django haystack, and have multivalued fields where Django expects singlevalued - i.e. a list is being returned instead of a single scalar value.
– MatsLindh
Nov 25 '18 at 21:35
add a comment |
I implemented solr 6.5 for django 2.1 with haystack 2.5 and i succesfully built index but theres still no search results
q*:* returns
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"*:*",
"indent":"on",
"wt":"json",
"_":"1543140724323"}},
"response":{"numFound":5,"start":0,"docs":[
{
"id":"blog.post.1",
"django_ct":["blog.post"],
"publish":["2019-05-26T04:46:00+00:00Z"],
"text":["Chwalmy wodzansanacja, wódz, historia, sumienienBo jeden jest wódznn"],
"django_id":[1],
"_version_":1618099571920994304},
{
"id":"blog.post.3",
"django_ct":["blog.post"],
"publish":["2018-11-15T20:59:39+00:00Z"],
"text":["Trwoga Krzyk Gardłowynwódznsomenn"],
"django_id":[3],
"_version_":1618099571923091456},
{
"id":"blog.post.4",
"django_ct":["blog.post"],
"publish":["2018-11-15T21:24:01+00:00Z"],
"text":["Jeszcze jeden postnsanacja, wódznChwalmy wodzann"],
"django_id":[4],
"_version_":1618099571924140032},
{
"id":"blog.post.5",
"django_ct":["blog.post"],
"publish":["2018-11-21T14:41:25+00:00Z"],
"text":["Yepnsanacja, wódznffffnn"],
"django_id":[5],
"_version_":1618099571925188608},
{
"id":"blog.post.7",
"django_ct":["blog.post"],
"publish":["2018-11-21T21:30:30+00:00Z"],
"text":["Markdownnhistoria, sanacja, wódzn*wyróżnienie* **pogrubienie**nlistę:nnnnnSometimes you want bullet points:nn* Start a line with a starn* Profit!n* Start a line with a starn* ElsennTutaj jest [sabaton](https://www.youtube.com/watch?v=_HLNMfCBUb0)nn"],
"django_id":[7],
"_version_":1618099571925188609}]
So core is populated
My view:
def post_search(request):
form = SearchForm()
if 'query' in request.GET:
form = SearchForm(request.GET)
if form.is_valid():
cd = form.cleaned_data
results = SearchQuerySet().models(Post)
.filter(content=cd['query']).load_all()
# Obliczenie całkowitej liczby wyników.
total_results = results.count()
return render(request,
'blog/post/search.html',
{'form': form,
'cd': cd,
'results': results,
'total_results': total_results})
else:
return render(request,
'blog/post/search.html',
{'form': form})
And my form
class SearchForm(forms.Form):
query = forms.CharField()
I tried procedure proposed by haystack itself
>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet().all()
>>> sqs.count()
But I only recived
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/query.py", line 522, in count
return len(self)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/query.py", line 86, in __len__
self._result_count = self.query.get_count()
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/__init__.py", line 619, in get_count
self.run()
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 802, in run
results = self.backend.search(final_query, **search_kwargs)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/__init__.py", line 33, in wrapper
return func(obj, query_string, *args, **kwargs)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 149, in search
distance_point=kwargs.get('distance_point'))
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 425, in _process_results
app_label, model_name = raw_result[DJANGO_CT].split('.')
AttributeError: 'list' object has no attribute 'split'
So here's the problem, posts are indexed but unable to search and I really run out of ideas at this point
django solr
I implemented solr 6.5 for django 2.1 with haystack 2.5 and i succesfully built index but theres still no search results
q*:* returns
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"*:*",
"indent":"on",
"wt":"json",
"_":"1543140724323"}},
"response":{"numFound":5,"start":0,"docs":[
{
"id":"blog.post.1",
"django_ct":["blog.post"],
"publish":["2019-05-26T04:46:00+00:00Z"],
"text":["Chwalmy wodzansanacja, wódz, historia, sumienienBo jeden jest wódznn"],
"django_id":[1],
"_version_":1618099571920994304},
{
"id":"blog.post.3",
"django_ct":["blog.post"],
"publish":["2018-11-15T20:59:39+00:00Z"],
"text":["Trwoga Krzyk Gardłowynwódznsomenn"],
"django_id":[3],
"_version_":1618099571923091456},
{
"id":"blog.post.4",
"django_ct":["blog.post"],
"publish":["2018-11-15T21:24:01+00:00Z"],
"text":["Jeszcze jeden postnsanacja, wódznChwalmy wodzann"],
"django_id":[4],
"_version_":1618099571924140032},
{
"id":"blog.post.5",
"django_ct":["blog.post"],
"publish":["2018-11-21T14:41:25+00:00Z"],
"text":["Yepnsanacja, wódznffffnn"],
"django_id":[5],
"_version_":1618099571925188608},
{
"id":"blog.post.7",
"django_ct":["blog.post"],
"publish":["2018-11-21T21:30:30+00:00Z"],
"text":["Markdownnhistoria, sanacja, wódzn*wyróżnienie* **pogrubienie**nlistę:nnnnnSometimes you want bullet points:nn* Start a line with a starn* Profit!n* Start a line with a starn* ElsennTutaj jest [sabaton](https://www.youtube.com/watch?v=_HLNMfCBUb0)nn"],
"django_id":[7],
"_version_":1618099571925188609}]
So core is populated
My view:
def post_search(request):
form = SearchForm()
if 'query' in request.GET:
form = SearchForm(request.GET)
if form.is_valid():
cd = form.cleaned_data
results = SearchQuerySet().models(Post)
.filter(content=cd['query']).load_all()
# Obliczenie całkowitej liczby wyników.
total_results = results.count()
return render(request,
'blog/post/search.html',
{'form': form,
'cd': cd,
'results': results,
'total_results': total_results})
else:
return render(request,
'blog/post/search.html',
{'form': form})
And my form
class SearchForm(forms.Form):
query = forms.CharField()
I tried procedure proposed by haystack itself
>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet().all()
>>> sqs.count()
But I only recived
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/query.py", line 522, in count
return len(self)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/query.py", line 86, in __len__
self._result_count = self.query.get_count()
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/__init__.py", line 619, in get_count
self.run()
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 802, in run
results = self.backend.search(final_query, **search_kwargs)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/__init__.py", line 33, in wrapper
return func(obj, query_string, *args, **kwargs)
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 149, in search
distance_point=kwargs.get('distance_point'))
File "/home/hesmeron/first_env/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 425, in _process_results
app_label, model_name = raw_result[DJANGO_CT].split('.')
AttributeError: 'list' object has no attribute 'split'
So here's the problem, posts are indexed but unable to search and I really run out of ideas at this point
django solr
django solr
edited Nov 25 '18 at 13:08
Kajetan Radulski
asked Nov 25 '18 at 10:58
Kajetan RadulskiKajetan Radulski
12
12
you should show the full stack trace. as it is, the error description you have here isn't enough.
– Jason
Nov 25 '18 at 12:56
Ok I just added that
– Kajetan Radulski
Nov 25 '18 at 13:09
1
ok so its an issue inside haystack, asa you can see from the paths in the stack trace. googlingdjango haystack attribute error list object has no attribute split
returns a number of results, including github.com/django-haystack/django-haystack/issues/1200 which might help
– Jason
Nov 25 '18 at 13:16
My initial guess is that you haven't made Solr use the generated schema from django haystack, and have multivalued fields where Django expects singlevalued - i.e. a list is being returned instead of a single scalar value.
– MatsLindh
Nov 25 '18 at 21:35
add a comment |
you should show the full stack trace. as it is, the error description you have here isn't enough.
– Jason
Nov 25 '18 at 12:56
Ok I just added that
– Kajetan Radulski
Nov 25 '18 at 13:09
1
ok so its an issue inside haystack, asa you can see from the paths in the stack trace. googlingdjango haystack attribute error list object has no attribute split
returns a number of results, including github.com/django-haystack/django-haystack/issues/1200 which might help
– Jason
Nov 25 '18 at 13:16
My initial guess is that you haven't made Solr use the generated schema from django haystack, and have multivalued fields where Django expects singlevalued - i.e. a list is being returned instead of a single scalar value.
– MatsLindh
Nov 25 '18 at 21:35
you should show the full stack trace. as it is, the error description you have here isn't enough.
– Jason
Nov 25 '18 at 12:56
you should show the full stack trace. as it is, the error description you have here isn't enough.
– Jason
Nov 25 '18 at 12:56
Ok I just added that
– Kajetan Radulski
Nov 25 '18 at 13:09
Ok I just added that
– Kajetan Radulski
Nov 25 '18 at 13:09
1
1
ok so its an issue inside haystack, asa you can see from the paths in the stack trace. googling
django haystack attribute error list object has no attribute split
returns a number of results, including github.com/django-haystack/django-haystack/issues/1200 which might help– Jason
Nov 25 '18 at 13:16
ok so its an issue inside haystack, asa you can see from the paths in the stack trace. googling
django haystack attribute error list object has no attribute split
returns a number of results, including github.com/django-haystack/django-haystack/issues/1200 which might help– Jason
Nov 25 '18 at 13:16
My initial guess is that you haven't made Solr use the generated schema from django haystack, and have multivalued fields where Django expects singlevalued - i.e. a list is being returned instead of a single scalar value.
– MatsLindh
Nov 25 '18 at 21:35
My initial guess is that you haven't made Solr use the generated schema from django haystack, and have multivalued fields where Django expects singlevalued - i.e. a list is being returned instead of a single scalar value.
– MatsLindh
Nov 25 '18 at 21:35
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466782%2fno-search-results-django-2-1-solr-6-5%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466782%2fno-search-results-django-2-1-solr-6-5%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you should show the full stack trace. as it is, the error description you have here isn't enough.
– Jason
Nov 25 '18 at 12:56
Ok I just added that
– Kajetan Radulski
Nov 25 '18 at 13:09
1
ok so its an issue inside haystack, asa you can see from the paths in the stack trace. googling
django haystack attribute error list object has no attribute split
returns a number of results, including github.com/django-haystack/django-haystack/issues/1200 which might help– Jason
Nov 25 '18 at 13:16
My initial guess is that you haven't made Solr use the generated schema from django haystack, and have multivalued fields where Django expects singlevalued - i.e. a list is being returned instead of a single scalar value.
– MatsLindh
Nov 25 '18 at 21:35