Problems searching with the Catalog

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems searching with the Catalog

Àlex Magaz Graça
Hi,

I'm having some problems searching.

The following fails, I guess, because "and" must be some kind of a
keyword for searchResults() or something:

catalog = getUtility(ICatalog)
catalog.searchResults(textattr="foo and")

where textattr = grok.index.Text(). Is there some way to avoid this?

How do I match two non-consecutive values in an Field index? For
example, objects which have 1 or 4 as a value in a given attribute.

It would help a lot if someone could point me to the API documentation
of the catalog, I can't find it...

Thanks!
Àlex

_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problems searching with the Catalog

Alexandre Garel-2
Le 12/12/2011 19:55, Àlex Magaz Graça a écrit :

> Hi,
>
> I'm having some problems searching.
>
> The following fails, I guess, because "and" must be some kind of a
> keyword for searchResults() or something:
>
> catalog = getUtility(ICatalog)
> catalog.searchResults(textattr="foo and")
>
> where textattr = grok.index.Text(). Is there some way to avoid this?

Did you try 'foo "and"' ?


>
> How do I match two non-consecutive values in an Field index? For
> example, objects which have 1 or 4 as a value in a given attribute.
If you want to do this I think you'd better go with a Keyword index,
with FieldIndex you shall be able to ask for a range eg (1,4) for 1, 2, 3, 4

> It would help a lot if someone could point me to the API documentation
> of the catalog, I can't find it...

You may look at zope/index/field/README.txt or
zope/index/text/textindex.txt even if its  low-level documentation

Hope it helps,

Alex


--
Alexandre Garel
06 78 33 15 37

_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problems searching with the Catalog

Àlex Magaz Graça
Hi Alex,

El 12/12/11 21:29, Alexandre Garel escribió:

> Le 12/12/2011 19:55, Àlex Magaz Graça a écrit :
>> Hi,
>>
>> I'm having some problems searching.
>>
>> The following fails, I guess, because "and" must be some kind of a
>> keyword for searchResults() or something:
>>
>> catalog = getUtility(ICatalog)
>> catalog.searchResults(textattr="foo and")
>>
>> where textattr = grok.index.Text(). Is there some way to avoid this?
>
> Did you try 'foo "and"' ?
>
>

I was passing the search string entered by the user directly to
searchResults() and didn't thought about trying this. I've resolved the
problem quoting the words in the string.

>>
>> How do I match two non-consecutive values in an Field index? For
>> example, objects which have 1 or 4 as a value in a given attribute.
> If you want to do this I think you'd better go with a Keyword index,
> with FieldIndex you shall be able to ask for a range eg (1,4) for 1,
> 2, 3, 4
>

It worked using grok.index.Value. By the way, I'm not sure, but it seems
like the documentation of Value and Set should be exchanged.

>> It would help a lot if someone could point me to the API
>> documentation of the catalog, I can't find it...
>
> You may look at zope/index/field/README.txt or
> zope/index/text/textindex.txt even if its  low-level documentation
>

Oh! I missed the second one. I'm so desperate for documentation that I'm
even looking at this kind of documentation through different eyes ;-)

Thanks a lot for the help!

Àlex
_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev