AttributeError: Solr instance has no attribute 'query'

495 views
Skip to first unread message

Manabu Terada

unread,
Feb 22, 2011, 12:01:05 AM2/22/11
to solrpy
Hi,

I'm using solrpy 0.9.4, but I can't search by `query`.
How to use this module?

>>> import solr
>>> s = solr.Solr('http://localhost:8983/solr')
>>> doc = dict(id=1, title="terada test", author=['manabu'],)
>>> s.add(doc, commit=True)
'<?xml version="1.0" encoding="UTF-8"?>\n<response>\n<lst
name="responseHeader"><int name="status">0</int><int name="QTime">169</
int></lst>\n</response>\n'
>>> r = s.query('title:terada')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: Solr instance has no attribute 'query'

Ed Summers

unread,
Feb 22, 2011, 2:25:41 AM2/22/11
to solrpy
Hi Manabu,

Where you have:

s = solr.Solr("http://localhost:8983/solr")

try, this instead:

s = solr.SolrConnection("http://locahost:8983/solr")

Fred created some really nice (I think) Sphinx docs from the module
which might provide a gentler introduction:

http://packages.python.org/solrpy/

Let us know how it goes :-)

//Ed

Manabu Terada

unread,
Feb 22, 2011, 3:15:20 AM2/22/11
to sol...@googlegroups.com
HI Ed,

I just tried it, but I got another error.
It can't index `add` method too.


>>> s = solr.SolrConnection("http://locahost:8983/solr")

>>> response = s.query('title:lucene')


Traceback (most recent call last):
File "<stdin>", line 1, in <module>

File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 703, in query
File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 797,
in __call__
File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 822, in raw
File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 646, in _post
File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 625,
in _reconnect
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py",
line 683, in connect
self.timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py",
line 498, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
>>> s.add(doc, commit=True)


Traceback (most recent call last):
File "<stdin>", line 1, in <module>

File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 678, in add
File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 326,
in wrapper
File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 550,
in _update
File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 646, in _post
File "build/bdist.macosx-10.6-universal/egg/solr/core.py", line 625,
in _reconnect
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py",
line 683, in connect
self.timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py",
line 498, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known


2011/2/22 Ed Summers <e...@pobox.com>:

> --
> You received this message because you are subscribed to the Google Groups "solrpy" group.
> To post to this group, send email to sol...@googlegroups.com.
> To unsubscribe from this group, send email to solrpy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/solrpy?hl=en.
>
>

--
-----------------------------------------------------
寺田 学 Manabu TERADA <ter...@cmscom.jp>
(株)CMSコミュニケーションズ URL http://www.cmscom.jp
110-0016 東京都台東区台東3-18-7-101
Tel: 03-5856-0101 Mobile:080-5470-2420
-----------------------------------------------------

Axel Gerke

unread,
Feb 27, 2011, 5:55:49 AM2/27/11
to solrpy
Hi,

it's wrong in the documentation. Can someone of the owner fix it
there?

Best regards,

Axel
Reply all
Reply to author
Forward
0 new messages