Empty slice error

4 views
Skip to first unread message

Ali Rıza KELEŞ

unread,
Nov 2, 2009, 6:35:07 AM11/2/09
to Djapian Users
I want to use djapian latest release with django trunk on a stable
debian with python 2.5 and xapian 1.0.7. Also my web server is apache
with wsgi.

I did everything how tutorial says. But there is a problem. I tried to
test indexshell, some command's result are as below. list, use, total
and count commands work. But query command gives Empty slice error.
Also on web the side, submitting a query returns nothing. Apache
didn't reply.

local-1:/var/apps/ha# ./manage.py indexshell
Interactive Djapian shell.
>>> use 0.0.0
Using `global:content.Content:content.index.contentindexer` index.
>>> total
289
>>> list
Installed spaces/models/indexers:
* 0: `global`
* 0.0: `content.Content`
* 0.0.0: `content.index.contentindexer`
- 0.1: `content.Author`
- 0.1.0: `content.index.authorindexer`
- 0.2: `content.News_Sources`
- 0.2.0: `content.index.news_sourcesindexer`
>>> count can
16
>>> count pol
0
>>> count test
2
>>> query can
Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/lib/python2.5/site-packages/django/core/management/
__init__.py", line 439, in execute_manager
utility.execute()
File "/usr/lib/python2.5/site-packages/django/core/management/
__init__.py", line 380, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.5/site-packages/django/core/management/
base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python2.5/site-packages/django/core/management/
base.py", line 222, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.5/site-packages/djapian/management/commands/
indexshell.py", line 208, in handle
Interpreter(*args).cmdloop("Interactive Djapian shell.")
File "/usr/lib/python2.5/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.5/cmd.py", line 219, in onecmd
return func(arg)
File "/usr/lib/python2.5/site-packages/djapian/management/commands/
indexshell.py", line 16, in _decorator
return func(cmd, arg)
File "/usr/lib/python2.5/site-packages/djapian/management/commands/
indexshell.py", line 24, in _decorator
return func(cmd, *bits)
File "/usr/lib/python2.5/site-packages/djapian/management/commands/
indexshell.py", line 104, in do_query
_slice = slice(*self._parse_slice(_slice))
File "/usr/lib/python2.5/site-packages/djapian/management/commands/
indexshell.py", line 194, in _parse_slice
raise ValueError("Empty slice")
ValueError: Empty slice


Thanks,

--
Ali Rıza Keleş

Alex Koshelev

unread,
Nov 2, 2009, 11:19:22 AM11/2/09
to djapia...@googlegroups.com
Hi, Ali Rıza!

Yes, query command shall not force to use slice. It is known issue [1] and I'll fix it as soon as I can.

[1]: http://code.google.com/p/djapian/issues/detail?id=91

---
Alex Koshelev

Ali Rıza Keleş

unread,
Nov 2, 2009, 3:54:10 PM11/2/09
to djapia...@googlegroups.com
On Mon, 2009-11-02 at 19:19 +0300, Alex Koshelev wrote:
> Hi, Ali Rıza!
>
> Yes, query command shall not force to use slice. It is known issue [1]
> and I'll fix it as soon as I can.
>
Thanks for your replying kindly. I wish to fix but I prefer to wait for
your patch :). I need one more year to be interested in python to do it.

Well, I want to be sure about one more thing. The same issue that is why
my web application doesn't work, isn't it?

Regards,

--
Ali Rıza

Alex Koshelev

unread,
Nov 3, 2009, 4:50:58 PM11/3/09
to djapia...@googlegroups.com
On Mon, Nov 2, 2009 at 11:54 PM, Ali Rıza Keleş <ali.r...@gmail.com> wrote:

On Mon, 2009-11-02 at 19:19 +0300, Alex Koshelev wrote:
> Hi, Ali Rıza!
>
> Yes, query command shall not force to use slice. It is known issue [1]
> and I'll fix it as soon as I can.
>
Thanks for your replying kindly. I wish to fix but I prefer to wait for
your patch :). I need one more year to be interested in python to do it.

I've done some fixes and just now you can try again to query with no slice specified.

 
Well, I want to be sure about one more thing. The same issue that is why
my web application doesn't work, isn't it?

I don't think so. I was local indexshell issue. Feel free to file new ticket or post your problem to mailing list.

---
Alex Koshelev


Ali Rıza Keleş

unread,
Nov 4, 2009, 5:54:28 PM11/4/09
to djapia...@googlegroups.com
On Wed, 2009-11-04 at 00:50 +0300, Alex Koshelev wrote:
> On Mon, Nov 2, 2009 at 11:54 PM, Ali Rıza Keleş
> <ali.r...@gmail.com> wrote:
>
> On Mon, 2009-11-02 at 19:19 +0300, Alex Koshelev wrote:
> > Hi, Ali Rıza!
> >
> > Yes, query command shall not force to use slice. It is known
> issue [1]
> > and I'll fix it as soon as I can.
> >
>
> Thanks for your replying kindly. I wish to fix but I prefer to
> wait for
> your patch :). I need one more year to be interested in python
> to do it.
>
> I've done some fixes and just now you can try again to query with no
> slice specified.
OK. I tried it. And result is that
If I request one item, it works; but two doesn't.

Meanly
>>> query etha (works)
>>> query "etha istanbul" (works)
>>> query etha istanbul (does not work, give an error)

Terminal output as below.

>>> query etha
[<Hit: model=content.Content pk=305, percent=100 rank=0
weight=6.42380005352>, <Hit: model=content.Content pk=120, percent=96
rank=1 weight=6.17325189522>, <Hit: model=content.Content pk=238,
percent=92 rank=2 weight=5.92355949336>, <Hit: model=content.Content
pk=198, percent=91 rank=3 weight=5.89642127426>, <Hit:
model=content.Content pk=96, percent=83 rank=4 weight=5.37230229927>,
<Hit: model=content.Content pk=360, percent=80 rank=5
weight=5.18220176636>]
>>> query "etha istanbul"
[]
>>> query etha istanbul
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
line 439, in execute_manager
utility.execute()
File
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
line 380, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File
"/usr/lib/python2.5/site-packages/django/core/management/base.py", line
195, in run_from_argv
self.execute(*args, **options.__dict__)
File
"/usr/lib/python2.5/site-packages/django/core/management/base.py", line
222, in execute
output = self.handle(*args, **options)
File
"/usr/lib/python2.5/site-packages/djapian/management/commands/indexshell.py", line 202, in handle
Interpreter(*args).cmdloop("Interactive Djapian shell.")
File "/usr/lib/python2.5/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.5/cmd.py", line 219, in onecmd
return func(arg)
File
"/usr/lib/python2.5/site-packages/djapian/management/commands/indexshell.py", line 16, in _decorator
return func(cmd, arg)
File
"/usr/lib/python2.5/site-packages/djapian/management/commands/indexshell.py", line 24, in _decorator
return func(cmd, *bits)
File
"/usr/lib/python2.5/site-packages/djapian/management/commands/indexshell.py", line 104, in do_query
print
list(self._current_index.search(query)[self._parse_slice(_slice)])
File
"/usr/lib/python2.5/site-packages/djapian/management/commands/indexshell.py", line 182, in _parse_slice
bits = map(int, [b for b in _slice.split(delimeter, 2) if b]) or
default
ValueError: invalid literal for int() with base 10: 'istanbul'



> Well, I want to be sure about one more thing. The same issue
> that is why
> my web application doesn't work, isn't it?
>
> I don't think so. I was local indexshell issue. Feel free to file new
> ticket or post your problem to mailing list.

Yes, I think I did some mistakes elsewhere. Because it still fails. The
worse is I don't see any error. Apache doesnt reply and fails. In apache
logs there is nothing. How can i traceback this process?

Thanks..

>
> ---
> Alex Koshelev
>
>
>
>
> >

Ali Rıza KELEŞ

unread,
Nov 4, 2009, 7:22:08 PM11/4/09
to djapia...@googlegroups.com
2009/11/5 Ali Rıza Keleş <ali.r...@gmail.com>:

I have found what is wrong. This solved my problem. Web application
works fine now.. Also querying multiple words works too.

http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API

I think it would be better to place a note on wiki page about using apache wsgi.

Thanks again..

--
Ali Rıza Keleş

Reply all
Reply to author
Forward
0 new messages