Re: Free text search using disjunctions

106 views
Skip to first unread message

Michael Brunton-Spall

unread,
Aug 20, 2012, 8:25:45 AM8/20/12
to guardian...@googlegroups.com
Hey Filippo,

Sorry for the delay, I missed this email in the deluge of emails.

We use Lucene behind the scenes for free text parsing, you cna find a complete syntax guide at: http://lucene.apache.org/core/old_versioned_docs/versions/3_1_0/queryparsersyntax.html

I believe that doing "fish" or "meat" should work for you, although I'd have to double check how much we trim down your search term before passing it to Lucene.

hope that helps

Michael Brunton-Spall
guardian.co.uk

On Thursday, 26 July 2012 15:01:09 UTC+1, Filippo Tampieri wrote:
I need to use the free text search api to look for documents that contain any one of a sequence of terms; however, if I set the q parameter to more than one term (say q=fish meat) I only get back documents that contain all the terms.
I have tried fish|meat or (fish OR meat), but none of them worked.
Does anyone know what the syntax for the q parameter is?
Thank you

Michael Brunton-Spall

unread,
Nov 27, 2012, 11:18:48 AM11/27/12
to Guardian API Talk
Heya Kaspar,

Looking at the code, I think that should work, but given that it doesn't I can only assume that for some reason our search index is assuming that OR is a word, so it's looking for content with the words "berlin", "darmstadt" and "or".
I've tried a number of things locally but can't seem to get the ability to perform an OR query on a text search on the content.

I'm afraid that it therefore looks impossible to do on the content api at the moment.  I'll add it to our backlog of features and keep you updated on the status.

Michael Brunton-Spall
guardian.co.uk


On 27 November 2012 15:35, Kaspar Fischer <kaspar....@dreizak.com> wrote:
Hi everybody,

I can confirm that the NOT operator works, however, OR does not work in my experiments:


has 20886 hits, but http://explorer.content.guardianapis.com/#/search?q=berlin+OR+darmstadt&format=json&api-key= has 27 hits, that is, less hits even though the result set should be larger.

Is there a syntax for OR terms?

Thanks!
Kaspar
--
You received this message because you are subscribed to the Google Groups "Guardian API Talk" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/guardian-api-talk/-/WNuo6n_9o4UJ.

To post to this group, send an email to guardian...@googlegroups.com.
To unsubscribe from this group, send email to guardian-api-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/guardian-api-talk?hl=en-GB.

Please consider the environment before printing this email.
------------------------------------------------------------------
Visit guardian.co.uk - website of the year
 
www.guardian.co.uk    www.observer.co.uk     www.guardiannews.com 
 
On your mobile, visit m.guardian.co.uk or download the Guardian
iPhone app www.guardian.co.uk/iphone and iPad edition www.guardian.co.uk/iPad 
 
Save up to 37% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access. 
Visit guardian.co.uk/subscribe
 
---------------------------------------------------------------------
This e-mail and all attachments are confidential and may also
be privileged. If you are not the named recipient, please notify
the sender and delete the e-mail and all attachments immediately.
Do not disclose the contents to another person. You may not use
the information for any purpose, or store, or copy, it in any way.
 
Guardian News & Media Limited is not liable for any computer
viruses or other material transmitted with or as part of this
e-mail. You should employ virus checking software.
 
Guardian News & Media Limited
 
A member of Guardian Media Group plc
Registered Office
PO Box 68164
Kings Place
90 York Way
London
N1P 2AP
 
Registered in England Number 908396

Marijn Schraagen

unread,
Aug 5, 2014, 7:18:17 AM8/5/14
to guardian...@googlegroups.com
Hi,

Some time has passed since this topic was discussed, are there any developments? Currently the use of search operators is still somewhat unclear. For example, the following query is intended as an AND-query for terms 'arms' and 'treaty':
http://beta.content.guardianapis.com/search?q=arms&q=treaty&order-by=oldest&api-key=xxx
However, the first result is an article from 1873 which contains the term 'treaty' but not the term 'arms':
http://www.theguardian.com/theguardian/1873/mar/12/fromthearchive.zanzibar
Are there any general guidelines on how to use search operators, or an overview of preprocessing steps performed by the API?

Thanks!

On Tuesday, 27 November 2012 17:21:28 UTC+1, Kaspar Fischer wrote:
Michael,

thanks for the quick response and the clarification.

I'll follow this post for any updates in the future.

Cheers,
Kaspar

Michael Hockenhull

unread,
Oct 1, 2014, 3:26:06 PM10/1/14
to guardian...@googlegroups.com
I second the above query - having a lot of trouble figuring out the operators, which don't seem to be behaving according to the Lucene guide any longer. If anyone could clarify it would be a great help!

Cheers!

Mariot Chauvin

unread,
Oct 1, 2014, 3:29:48 PM10/1/14
to guardian...@googlegroups.com
We don't support properly operators for the moment and this is not currently on our backlog.


To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-t...@googlegroups.com.
To post to this group, send email to guardian...@googlegroups.com.
Visit this group at http://groups.google.com/group/guardian-api-talk.
For more options, visit https://groups.google.com/d/optout.



Visit theguardian.com. On your mobile and tablet, download the Guardian iPhone and Android apps theguardian.com/guardianapp and our tablet editions theguardian.com/editions.  Save up to 57% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access.  Visit subscribe.theguardian.com

This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way.  Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.
 
Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP.  Registered in England Number 908396


Michael Hockenhull

unread,
Oct 1, 2014, 3:46:56 PM10/1/14
to guardian...@googlegroups.com
Ah, that's a shame! Thank you very much for your quick response. 

chris.b...@guardian.co.uk

unread,
Feb 18, 2015, 10:19:01 AM2/18/15
to guardian...@googlegroups.com
Hi everyone,

We've just released support for boolean operators and phrase search. 

You can now search for things like:
* "david beckham"
* obama AND bush
* (obama OR clinton) AND bush

e.g. here's a phrase search for "david beckham":

We've also added a section to the documentation(http://open-platform.theguardian.com/documentation/) about this new feature.

Also note that the default operator is OR, so searching for 'fish meat' (without the quotes) would find all articles containing either word.

Please give the new search operators a try and let us know if you have any problems.

Chris
Reply all
Reply to author
Forward
0 new messages