Skip to content

can't query on UUID field #60

@hmmbug

Description

@hmmbug

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions