Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't query on UUID field #60

Open
hmmbug opened this issue Sep 17, 2012 · 0 comments
Open

can't query on UUID field #60

hmmbug opened this issue Sep 17, 2012 · 0 comments

Comments

@hmmbug
Copy link

hmmbug commented Sep 17, 2012

Hi, I'm unable to search on a UUIDField. Is this by design? (or am I just stupid and doing it wrong?!) I couldn't see any examples in the docs or from google search). You help is appreciated. Thanks.

in schema.xml (field "entryid" is defined as a solr.UUIDField):
<field name="entryid" type="uuid" indexed="true" stored="true" multiValued="false" required="true"/>
(this field in my config is also the uniqueKey)

running a simple "entryid:018596d0-2077-4089-a676-b8cfc72b76b1" query from the solr web admin interface returns the correct doc.

in python:

r=si.query(entryid='018596d0-2077-4089-a676-b8cfc72b76b1').execute()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/sunburnt.py", line 219, in query
    return q.query(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/search.py", line 387, in query
    newself.query_obj.add(args, kwargs)
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/search.py", line 296, in add
    self.add_exact(field_name, v, terms_or_phrases)
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/search.py", line 320, in add_exact
    this_term_or_phrase = term_or_phrase or self.term_or_phrase(inst.value)
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/search.py", line 347, in term_or_phrase
    return 'terms' if self.default_term_re.match(arg) else 'phrases'
TypeError: expected string or buffer

also tried as a python UUID:

r=si.query(entryid=uuid.UUID('018596d0-2077-4089-a676-b8cfc72b76b1')).execute()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/sunburnt.py", line 219, in query
    return q.query(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/search.py", line 387, in query
    newself.query_obj.add(args, kwargs)
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/search.py", line 296, in add
    self.add_exact(field_name, v, terms_or_phrases)
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/search.py", line 320, in add_exact
    this_term_or_phrase = term_or_phrase or self.term_or_phrase(inst.value)
  File "/usr/local/lib/python2.6/dist-packages/sunburnt/search.py", line 347, in term_or_phrase
    return 'terms' if self.default_term_re.match(arg) else 'phrases'
TypeError: expected string or buffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant