On Thu, 28 Feb 2013, Alexander Wagner wrote:
> But as far as I understand it (here you're the experts) this stems
> from the fact that search_pattern() does not really like a complex
> query like "pub:2008->2012", right?

Nope, s_p() does support complex queries of that kind:

| In [1]: from invenio.search_engine import search_pattern
|
| In [2]: search_pattern(p='year:1980->1993')
| Out[2]: intbitset([9, 13, 14, 16, 17, 18, 19, 20, 40, 41, 42, 67])

You can do virtually everything in search_pattern() except for nested
parentheses.  These are handled by search_pattern_parenthesised().  You
can call s_p_p() instead of s_p() in your mid-level API if you are not
sure whether you need nested parentheses support.  The only price to pay
for doing this would be slightly slower response time.

> ie. I don't have to take care of deleted records and such.

Yes, this is the domain of collections, hence the domain of p_r_s(),
which is why it is a higher-level API.

(Note that webcoll automatically removes deleted records.  When a
collection Foo is defined via query `p=foo', then when webcoll runs and
queries the database in order to discover which records belong to
collection Foo, it silently adds `-980__:"DELETED"' to the query before
calling s_p_p().  p_r_s() then profits from this s_p_p() background job,
so to speak.)

Best regards
--
Tibor Simko

Reply via email to